To study the solid solution strengthening effect on magnesium (Mg)-X (X = Al, Er) alloys, supercell models of Mg, Mg 35 Er and Mg 35 Al are established to perform the first-principles pseudopotential plane wave calculations based on density functional theory. The calculated cohesive energy of Mg 35 Er is lower than that of Mg 35 Al. This indicates that Mg 35 Er has better structural stability than Mg 35 Al. The bulk modulus, Young's modulus and shear modulus of the solid solutions increases simultaneously when Al and Er are doped into the Mg matrix. Moreover, the solid solution strengthening of Er is much higher than the Al containing alloy. The order of toughness of the three solutions from the highest to the lowest is Mg, Mg 35 Er and Mg 35 Al, while the order of increasing elastic anisotropy is in the reverse order. The number of bonding electrons of Mg 35 Er in the low-energy region of the Fermi level is much higher than that of Mg 35 Al, and the density of states of Mg 35 Er at the Fermi level is higher than that of Mg 35 Al. Compared with Al atoms, Er atoms share more electric charges with Mg atoms, which leads to an increasingly uniform charge distribution around Er atoms.