Long-term memory formation (LTM) is a process accompanied by energy-demanding structural changes at synapses and increased spine density. Concomitant increases in both spine volume and postsynaptic density (PSD) surface area have been suggested but never quantified in vivo by clear-cut experimental evidence. Using novel object recognition in mice as a learning task followed by 3D electron microscopy analysis, we demonstrate that LTM induced all aforementioned synaptic changes, together with an increase in the size of astrocytic glycogen granules, which are a source of lactate for neurons. The selective inhibition of glycogen metabolism in astrocytes impaired learning, affecting all the related synaptic changes. Intrahippocampal administration of l-lactate rescued the behavioral phenotype, along with spine density within 24 hours. Spine dynamics in hippocampal organotypic slices undergoing theta burst-induced long-term potentiation was similarly affected by inhibition of glycogen metabolism and rescued by l-lactate. These results suggest that learning primes astrocytic energy stores and signaling to sustain synaptic plasticity via l-lactate.