In the title compound, [Mg(C6H2N2O4)(H2O)4]·H2O, the Mg(II) ion is coordinated by a fully deprotonated pyrimidine-4,6-dicarboxyl-ate mol-ecule, via a ring N and a carboxyl-ate O atom, and by four water O atoms at the apices of a slightly distorted octa-hedron. In the crystal, mol-ecules are linked by O-H⋯O and O-H⋯N hydrogen bonds, forming a three-dimensional network.