A kind of alloy, which is anti-squirming, and the components of it and the weight percent of them is: 1.5-10%Y, 0.15-2.0%Zr, 0.3-2.0%Nd, 2.5-8%Gd, and one kind or several kinds of components among Sm, Dy, Tb, Ho, Er, Tm and Eu is also contained, the other is Mg. the following steps are contained in the method: (1) To prepare material (2) To improve the temperature of warm-up stove and melting stove (3) To warm up the material (4) To melt the purified magnesium ingots in batches (5) To melt the other materials, which has been warmed up, in the Mg solution. (6) To distribute equably the alloy components in the Mg solution. (7) To make into casting ingot, cast, billet, board material, pipe material, model material, stick material, line material and all kinds of forged piece. The Mg alloy can fulfill the need owing a higher mechanics performance and anti-squirming performance under high temperate, and the anti-causticity performance is higher than the Mg in existence.