Mg (s) + 2HCl (aq) → MgCl2 (aq) + H2 (g)
In this reaction, magnesium loses its valence electrons to the chloride ions (Cl-) in hydrochloric acid, forming magnesium chloride. The hydrogen ions (H+) from hydrochloric acid combine with electrons from magnesium, forming hydrogen gas. The resulting solution contains magnesium chloride dissolved in water and hydrogen gas released as a product of the reaction.