Take 5 ml original solution in a test tube. Add aqueous NH3. Now add 1 mL solution of NaH2PO4 and scratch the walls of test tube with the glass rod.

Formation of white precipitate indicates the presence of Mg2+ ion.