Injection of chemically tuned brines into carbonate reservoirs has been reported to enhance oil recovery by 5% to 30% OOIP in core flooding experiments and field tests. One proposed mechanism for this improved oil recovery (IOR) is wettability alteration of rock from oil wet or mixed-wet to more water wet conditions. Modeling of wettability alteration experiments, however, are challenging due to the complex interactions among ions in the brine and crude oil on the solid surface. In this research, we developed a multiphase multicomponent reactive transport model that explicitly takes into account wettability alteration from these geochemical interactions in carbonate reservoirs. Published experimental data suggests that desorption of acidic oil components from rock surfaces make carbonate rocks more water wet. One widely accepted mechanism is that sulfate (SO4 2-) replaces the adsorbed carboxylic group from the rock surface while cations (Ca2+, Mg2+) decrease the oil surface potential. In the proposed mechanistic model, we used a reaction network that captures the competitive surface reactions among carboxylic groups, cations, and sulfate. These reactions control the wetting fractions and contact angles, which subsequently determine the capillary pressure, relative permeabilities, and residual oil saturations. The developed model was fifst tuned with experimental data from the Stevns Klint chalk and then used to predict oil recovery for additional un-tuned experiments under a variety of conditions where IOR increased by as much as 30% OOIP, depending on salinity and oil acidity. The numerical results showed that an increase in sulfate concentration can lead to an IOR of over 40% OOIP, while cations such as Ca2+ have a relatively minor effect on recovery (about 5% OOIP). Other physical parameters, including the total surface area of the rock and the diffusion coefficient, control the rate of recovery, however not the final oil recovery. The simulation results further demonstrate that the optimum brine formulation for chalk are those with relatively abundant SO4 2- (0.096 mol/kg water), moderate concentrations of cations, and low salinity (total ionic strength less than 0.2 mol/kg water). These findings are consistent with the experimental data reported in the literature. The new model provides a powerful tool to predict the IOR potential of chemically tuned waterflooding in carbonate reservoirs under different scenarios.