Refinement of mammalian neural circuits involves substantial experience-dependent synapse elimination. Using in vivo two-photon imaging, we found that experience-dependent elimination of postsynaptic dendritic spines in the cortex was accelerated in ephrin-A2 knockout (KO) mice, resulting in fewer adolescent spines integrated into adult circuits. Such increased spine removal in ephrin-A2 KOs depended on activation of glutamate receptors, as blockade of the N-methyl-D-aspartate (NMDA) receptors eliminated the difference in spine loss between wild-type and KO mice. We also showed that ephrin-A2 in the cortex colocalized with glial glutamate transporters, which were significantly downregulated in ephrin-A2 KOs. Consistently, glial glutamate transport was reduced in ephrin-A2 KOs, resulting in an accumulation of synaptic glutamate. Finally, inhibition of glial glutamate uptake promoted spine elimination in wild-type mice, resembling the phenotype of ephrin-A2 KOs. Together, our results suggest that ephrin-A2 regulates experience-dependent, NMDA receptor-mediated synaptic pruning through glial glutamate transport during maturation of the mouse cortex.