TRPM7, a divalent cation channel, plays an important role in neurons damaged from cerebral ischemia due to permitting intracellular calcium overload. This study aimed to explore whether magnesium was transported via a TRPM7 channel into the intracellular space of rat hippocampal neurons after 1 h of oxygen-glucose deprivation (OGD) and acute chemical ischemia (CI) by using methods of the Mg(2+) fluorescent probe Mag-Fura-2 to detect intracellular magnesium concentration ([Mg(2+)](i)) and flame atomic absorption spectrometry to measure extracellular magnesium concentration ([Mg(2+)](o)). The results showed that the neuronal [Mg(2+)](i) was 1.51-fold higher after 1 h of OGD at a basal level, and the increase of neuronal [Mg(2+)](i) reached a peak after 1 h of OGD and was kept for 60 min with re-oxygenation. Meanwhile, the [Mg(2+)](o) decreased after 1 h of OGD and recovered to the pre-ischemic level within 15 min after re-oxygenation. In the case of CI, the [Mg(2+)](i) peak immediately appeared in hippocampal neurons. This increase of [Mg(2+)](i) declined by removing extracellular magnesium in OGD or CI. Furthermore, by using Gd(3+) or 2-aminoethoxydiphenyl borate to inhibit TRPM7 channels, the [Mg(2+)](i) increase, which was induced by OGD or CI, was attenuated without altering the basal level of [Mg(2+)](i). By silencing TRPM7 with shRNA in hippocampal neurons, it was found that not only was the increase of [Mg(2+)](i) induced by OGD or CI but also the basal levels of [Mg(2+)](i) were attenuated. In contrast, overexpression of TRPM7 in HEK293 cells exaggerated both the basal levels and increased [Mg(2+)](i) after 1 h of OGD/CI. These results suggest that anoxia induced the increase of [Mg(2+)](i) via TRPM7 channels in rat hippocampal neurons.