GregLocock provides good information on this subject. I would like to elaborate on the point that he makes with respect to specific modulus (E/rho) and specific strength (sigma/rho). These values are useful when the loading is tensile in nature, e.g., when load, stiffness, and length are specified, and the section area is free.
Most complex components like automotive transmission housings have equally complex loading, with a great deal of bending involved, both in the form of global bending of the entire housing, and local bending/buckling of a particular section. When global bending is involved, the beam mode becomes important, i.e. external or self-weight loading, stiffness and length specified, section area is free. For this case, the Performance Index (term used by M. F. Ashby in his book Materials Selection in Mechanical Design, becomes E1/2 / rho or sigma1/2 / rho. This favors Mg over Al due to its much lower density.
When plate bending or buckling is important, i.e., loaded externally or by self weight in bending, stiffness, length, and width specified, thickness free, the Performance Index becomes E1/3 / rho or sigma1/3 / rho, which favors Mg even more than the previous case.
Another factor to keep in mind are the minimum practical wall thickness that can be achieved during casting. In pressure die casting, significantly thinner walls can be achieved with Mg than in Al. This becomes important when the loads are small enough that the Al wall thickness cannot be made any thinner due to manufacturing/casting constraints, and a similar wall thickness of Mg will perform adequately, and hence weigh less.