The hydrated carbonate mineral ikaite (CaCO3·6H2O) is thermodynamically unstable at all known conditions on Earth. Regardless, ikaite has been found in marine sediments, as tufa columns and in sea ice. The reason for these occurrences remains unknown. However, cold temperatures (<6°C), high pH and the presence of Mg2+ and SO42– in these settings have been suggested as factors that promote ikaite formation. Here we show that Mg concentration and pH are primary controls of ikaite precipitation at 5°C. In our experiments a sodium carbonate solution was mixed with seawater at a temperature of 5°C and at a constant rate. To test the effect of Mg2+ and SO42– we used synthetic seawater which allowed us to remove these elements from the seawater. The pH was controlled by different ratios of Na2CO3 and NaHCO3 in the carbonate solution. We found that ikaite precipitated when both seawater and synthetic seawater from which SO4 had been removed were used in the experiments. However, ikaite did not precipitate in experiments conducted with synthetic seawater from which Mg had been removed. In these experiments, calcite precipitated instead of ikaite. By varying the Mg concentration of the synthetic seawater and the pH of the sodium carbonate solution, we constructed a kinetic stability diagram for ikaite and calcite as a function of Mg concentration and pH. One possible explanation of our finding is that Mg2+ inhibits calcite nucleation and thereby allows metastable ikaite to form instead.