Potentials of the embedded atom model (EAM) for solid and liquid magnesium are proposed. Properties of magnesium are studied by means of molecular dynamics (MD) at binodals of up to 1500 K, and under conditions of static and shock compression. The main characteristics of bcc and liquid magnesium (structure, density, energy, compressibility, speed of sound, and coefficients of self-diffusion) are calculated. The static compression isotherm at 298 K up to a pressure of 108 GPa and the Hugoniot adiabat up to a pressure of 80 GPa are calculated with allowance for electron contributions. Values of the excess energy of the surfaces of magnesium nanoclusters with 13 to 2869 particles are found, and the Gibbs–Helmholtz equation for the relationship between surface tension and surface energy is estimated.