GO:0000287: magnesium ion binding
Interacting selectively and non-covalently with magnesium (Mg) ions.