Environmental contextThe behaviour of magnesium, which is an essential element for all living organisms, in terrestrial environments is influenced by natural organic matter. This study shows that magnesium binding by terrestrial humic acids exhibits a pronounced ionic strength-dependence indicating a strong preference for electrostatic binding to humic acids. This interaction is expected to influence the mobility of humic substances and their associated trace elements. AbstractMagnesium binding by three terrestrial humic acids was investigated at pH 8 and 25 °C as a function of Mg2+ activity and ionic strength using NaCl as the background electrolyte. The Mg2+ activity in solution was directly measured with an Mg2+-selective electrode in the titration experiments. In addition, coagulation experiments using Ca2+ and Mg2+ as the coagulants were carried out at pH 8. For the titration data, the NICA–Donnan model was used to quantitatively describe Mg2+ binding to the humic acids considering electrostatic and specific Mg2+ binding. Mg2+ binding to humic acids was found to be strongly affected by ionic strength variations indicating that Mg2+ binding largely arose from electrostatic (nonspecific) interactions with negatively charged functional groups of the humic acids. Data modelling suggested that the relative contribution of specific binding increased with decreasing Mg2+ activity and was related to functional groups with low proton affinities. For all three humic acids studied, the fitted Mg2+ affinity constants for specific binding were lower than the respective Ca2+ affinities. Corresponding to the observed differences in cation binding and the known differences in ion hydration, Ca2+ was observed to be the stronger coagulant as compared with Mg2+. The results suggest that Mg2+ may influence the mobility of trace elements that are strongly bound to humic acids such as mercury, although Mg2+ is not expected to directly compete with strongly sorbing elements for specific binding.