The development of dendritic spines is thought to be crucial for synaptic plasticity. Dendritic spines are retracted upon Eph receptor A4 (EphA4) activation, but the mechanisms that control this process are not well understood. Here we report an important function of cyclin-dependent kinase 5 (Cdk5) in EphA4-dependent spine retraction in mice. We found that blocking Cdk5 activity inhibits ephrin-A1-triggered spine retraction and reduction of mEPSC frequency at hippocampal synapses. The activation of EphA4 resulted in the recruitment of Cdk5 to EphA4, leading to the tyrosine phosphorylation and activation of Cdk5. EphA4 and Cdk5 then enhanced the activation of ephexin1, a guanine-nucleotide exchange factor that regulates activation of the small Rho GTPase RhoA. The association between EphA4 and ephexin1 was significantly reduced in Cdk5(-/-) brains and Cdk5-dependent phosphorylation of ephexin1 was required for the ephrin-A1-mediated regulation of spine density. These findings suggest that ephrin-A1 promotes EphA4-dependent spine retraction through the activation of Cdk5 and ephexin1, which in turn modulates actin cytoskeletal dynamics.