Magnesium react with hydrochloric acid according to the equation :
Mg(s)+2HCL(aq)----->MgCL2(aq) +H2(g)
This demonstration can be used to illustrate the characteristics reactions of metals with acid , a single replacement reaction ,or to demonstrate the generation of hydrogen gas.