Diamond formation has typically been attributed to redox reactions during precipitation from fluids or magmas. Either the oxidation of methane or the reduction of carbon dioxide has been suggested, based on simplistic models of deep fluids consisting of mixtures of dissolved neutral gas molecules without consideration of aqueous ions. The role of pH changes associated with water–silicate rock interactions during diamond formation is unknown. Here we show that diamonds could form due to a drop in pH during water–rock interactions. We use a recent theoretical model of deep fluids that includes ions, to show that fluid can react irreversibly with eclogite at 900 °C and 5.0 GPa, generating diamond and secondary minerals due to a decrease in pH at almost constant oxygen fugacity. Overall, our results constitute a new quantitative theory of diamond formation as a consequence of the reaction of deep fluids with the rock types that they encounter during migration. Diamond can form in the deep Earth during water–rock interactions without changes in oxidation state.