Mg + 2HCl---> MgCl2 + H2
This is a single replacement reaction.
Mg is oxidized to MgCl2 (+2)
2H is reduced to H2 (0)
Magnesium is oxidized from 0 in Mg to Mg2+ in its oxidation state in MgCl2.
Hydrogen is reduced from +1 in HCl to 0 in its oxidation state in H2.
So both oxidation and reduction occur simultaneously, making these as redox reactions.