Subtle changes in cellular and extracellular pH within the physiological range have profound impacts on synaptic activities. However, the molecular mechanisms underlying local pH regulation at synapses and their influence on synaptic structures have not been elucidated. Dendritic spines undergo dynamic structural changes in response to neuronal activation, which contributes to induction and long-term maintenance of synaptic plasticity. Although previous studies have indicated the importance of cytoskeletal rearrangement, vesicular trafficking, cell signaling, and adhesion in this process, much less is known about the involvement of ion transporters. In this study we demonstrate that N-methyl-D-aspartate (NMDA) receptor activation causes recruitment of the brain-enriched Na(+)/H(+) exchanger NHE5 from endosomes to the plasma membrane. Concomitantly, real-time imaging of green fluorescent protein-tagged NHE5 revealed that NMDA receptor activation triggers redistribution of NHE5 to the spine head. We further show that neuronal activation causes alkalinization of dendritic spines following the initial acidification, and suppression of NHE5 significantly retards the activity-induced alkalinization. Perturbation of NHE5 function induces spontaneous spine growth, which is reversed by inhibition of NMDA receptors. In contrast, overexpression of NHE5 inhibits spine growth in response to neuronal activity. We propose that NHE5 constrains activity-dependent dendritic spine growth via a novel, pH-based negative-feedback mechanism.