Dendritic spines have been proposed to transform synaptic signals through chemical and electrical compartmentalization. However, the quantitative contribution of spine morphology to synapse compartmentalization and its dynamic regulation are still poorly understood. We used time-lapse super-resolution stimulated emission depletion (STED) imaging in combination with fluorescence recovery after photobleaching (FRAP) measurements, two-photon glutamate uncaging, electrophysiology and simulations to investigate the dynamic link between nanoscale anatomy and compartmentalization in live spines of CA1 neurons in mouse brain slices. We report a diversity of spine morphologies that argues against common categorization schemes and establish a close link between compartmentalization and spine morphology, wherein spine neck width is the most critical morphological parameter. We demonstrate that spine necks are plastic structures that become wider and shorter after long-term potentiation. These morphological changes are predicted to lead to a substantial drop in spine head excitatory postsynaptic potential (EPSP) while preserving overall biochemical compartmentalization.