Fluids exert a key control on the mobility of elements at high pressure and temperature in the crust and mantle. However, the prediction of fluid composition and speciation in compositionally complex fluid–rock systems, typically present in subduction zones, has been hampered by multiple challenges. We develop a computational framework to study the role of phase equilibria and complex solid-solutions on aqueous fluid speciation in equilibrium with rocks to 900 °C and 3 GPa. This is accomplished by merging conventional phase-equilibrium modeling involving electrolyte-free molecular fluids, with an electrostatic approach to model solute–solute and solute–solvent interactions in the fluid phase. This framework is applied to constrain the activity ratios, composition of aqueous solutes, and pH of a fluid in equilibrium with a pelite lithology. Two solvent compositions are considered: pure H2O, and a COH fluid generated by equilibration of H2O and graphite. In both cases, we find that the pH is alkaline. Disparities between the predicted peralkalinity of our fluid ([Na]+[K])/[Al]∼6 to 12 and results from independent mineral solubility experiments (∼2) point to the presence of Na–K–Al–Si polymers representing ca. 60 to 85% of the total K and Al content of the fluid at 600 °C and 2.2 GPa, and to an important fraction of dissolved Ca and Mg not accounted for in present speciation models. The addition of graphite to the system reduces the relative permittivity by ca. 40% at elevated T and low P , triggers the formation of C-bearing anions, and brings the pH closer to neutrality by up to 0.6 units at low T. This ionic C pool represents up to 45 mol% of the fluid ligands at elevated P, and is dominant at low P despite the low ionic strength of the fluid (<0.05). The present study offers new possibilities for exploring redox–pH dependent processes that govern volatile, major and trace element partitioning between rocks and fluids in experimental or natural systems.