Anthropogenic nitrogen (N) deposition can alleviate N limitation and stimulate plant growth in many terrestrial ecosystems. While theoretical models often emphasize phosphorus limitations as a constraint on this positive N effect, the impact of N-induced magnesium (Mg) and calcium (Ca) deficits due to soil acidification has been largely overlooked. Here, we synthesized data from 243 experiments across diverse terrestrial ecosystems to investigate the role of Mg and Ca in plant biomass responses to N addition. We found that the effect of N addition on aboveground biomass (AGB) shifted from neutral in low pH (≤ 4.5) to positive in medium (4.5-7.5) and high pH (>
7.5) soils. By contrast, belowground biomass (BGB) responses to N addition were independent of soil pH, leading to asymmetric increases in AGB and BGB. These variations in biomass accumulation across pH levels were primarily explained by changes in foliar Mg and Ca concentrations, which were negatively affected by N addition in low-pH soils but remained stable in medium and high-pH soils. Our findings underscore the critical role of Mg and Ca in modulating plant responses to N fertilization, providing new insights for improving Earth system models and better predicting climate-biosphere feedback.