The structure and function of spines and excitatory synapses are under the dynamic control of multiple signalling networks. Although tyrosine phosphorylation is involved, its regulation and importance are not well understood. Here we study the role of Pyk2, a non-receptor calcium-dependent protein-tyrosine kinase highly expressed in the hippocampus. Hippocampal-related learning and CA1 long-term potentiation are severely impaired in Pyk2-deficient mice and are associated with alterations in NMDA receptors, PSD-95 and dendritic spines. In cultured hippocampal neurons, Pyk2 has autophosphorylation-dependent and -independent roles in determining PSD-95 enrichment and spines density. Pyk2 levels are decreased in the hippocampus of individuals with Huntington and in the R6/1 mouse model of the disease. Normalizing Pyk2 levels in the hippocampus of R6/1 mice rescues memory deficits, spines pathology and PSD-95 localization. Our results reveal a role for Pyk2 in spine structure and synaptic function, and suggest that its deficit contributes to Huntington’s disease cognitive impairments.