An in-depth knowledge and understanding of residual stress in dissimilar ultrasonic vibration-assisted friction stir welding (UVaFSW) are crucial for the performance evaluation of multimaterial structure designs; however, extensive research is still lacking. The present study evaluated the residual stress of dissimilar aluminium (Al)/magnesium (Mg) alloy joints produced by traditional FSW and UVaFSW to elucidate the ultrasonic effect mechanism with the aid of process simulation and microstructural evaluation. The weld surficial residual stress measured by X-ray diffraction (XRD) using the cos α method indicated the generation of predominantly compressive stress in UVaFSW welds. In agreement with the XRD measurements, the stress maps evaluated using the contour method (CM) exhibited an expanded compressive stress region and a mitigated tensile stress region in the UVaFSW welds. The Al/Mg interfacial mismatch of thermal expansion led to a tensile stress state on the Mg side and a compressive stress state on the Al side near the Al/Mg interface. The maximum compressive stress in the UVaFSW weld was ∼100 MPa higher than that in the FSW weld. The ultrasonic effect proficiently reduced the layer thicknesses of the intermetallic compounds (IMCs), promoting grain recrystallisation behaviour due to improved material transfer and mixing. Consequently, more homogeneous hardness distributions and improved tensile properties were formed in UVaFSW welds. However, ultrasonic vibration had an insignificant effect on the density of geometrically necessary dislocations and stored strain energy, indicating limited effects on microscopic residual stress in the studied condition. The ultrasonic vibration was found to positively mitigate residual tensile stresses and macroscopic distortion by increasing the temperature and encouraging material mixing within the stirred zone, as well as enhancing the stress interaction of the Al/Mg interface related to thinner IMCs. The UVaFSW has considerable potential to in-process co-optimise residual stress and microstructure for dissimilar Al/Mg welds.