This paper presents a diffusion-advection-reaction model for the pH of anoxic porewaters in nonirrigated sediments. Because of the couplings demanded by the organic-matter decay reaction, various acid-base interconversions, dissolved-iron generation, and CaCO3 and FeS precipitation, the model does not consider H+ alone, but deals simultaneously with 17 dissolved species. The complex and largely unknown kinetics of some of the processes affecting these species have been approximated by simple ad hoc formulations. For this reason, the model must be considered provisional. We have also made extensive use of the local (partial) equilibrium assumption to circumvent the computational problems generated by rapid association/dissociation reactions. The FOAM Site data are used as a vehicle to display the capabilities of this model. Assuming local equilibrium with FeS, the predicted pH profile is most sensitive to the reaction that liberates iron from the solid phase. The FOAM pH does not conform to a profile expected for anyone iron-source mineral, but appears to reflect a composite source. Based on currently available data, this source might include magnetite and silicate minerals, but is unlikely to involve ferric oxides and hydroxides. The pH of FOAM porewaters is much less sensitive to the precipitation of FeS and CaCO3 than would be suggested by past closed-system models. The overall pH stability of anoxic porewaters is attributable to the fact that the dissolved products of organic-matter decomposition are added in such a way as to form a self-buffering mixture.