Calcium (Ca) and magnesium (Mg) are the most abundant alkaline-earth metal ions in nature, and their interaction with ferrihydrite (Fh) affects the geochemical cycling of relevant ions, including phosphate (PO4). The interfacial interactions of Ca and Mg (M2+) with PO4 have not been analyzed yet for freshly precipitated Fh. Here, we studied experimentally this interaction in binary M2+-PO4 systems over a wide range of pH, M2+/PO4 ratios, and ion loadings. The primary adsorption data were scaled to the surface area of Fh using a recent ion-probing methodology that accounts for the size-dependent chemical composition of this nanomaterial (FeO1.4(OH)0.2·nH2O). The results have been interpreted with the charge distribution (CD) model, combined with a state-of-the-art structural surface model for Fh. The CD coefficients have been derived independently using MO/DFT/B3LYP/6-31+G*∗ optimized geometries. M2+ and PO4 mutually enhance their adsorption to Fh. This synergy results from the combined effect of ternary surface complex formation and increased electrostatic interactions. The type of ternary complex formed (anion- vs cation-bridged) depends on the relative binding affinities of the co-adsorbing ions. For our Ca-PO4 systems, modeling suggests the formation of two anion-bridged ternary complexes, i.e., (FeO)2PO2Ca and FeOPO3Ca. The latter is most prominently present, leading to a relative increase in the fraction of monodentate PO4 complexes. In Mg-PO4 systems, only the formation of the ternary FeOPO3Mg complex has been resolved. In the absence of Ca, the pH dependency of PO4 adsorption is stronger for Fh than for goethite, but this difference is largely, although not entirely, compensated in the presence of Ca. This study enables the use of Fh as a proxy for the natural oxide fraction, which will contribute to improved understanding of the mutual interactions of PO4 and M2+ in natural systems.