The salt formed when magnesium reacts with hydrochloric acid is magnesium chloride. The chemical reaction between magnesium and hydrochloric acid can be represented as follows:
Mg(s) + 2HCl(aq) → MgCl2(aq) + H2(g)
In this reaction, magnesium (Mg) metal reacts with hydrochloric acid (HCl) to form magnesium chloride (MgCl2) and hydrogen gas (H2).