Metabolic production of acetyl coenzyme A (acetyl-CoA) is linked to histone acetylation and gene regulation, but the precise mechanisms of this process are largely unknown. Here we show that the metabolic enzyme acetyl-CoA synthetase 2 (ACSS2) directly regulates histone acetylation in neurons and spatial memory in mammals. In a neuronal cell culture model, ACSS2 increases in the nuclei of differentiating neurons and localizes to upregulated neuronal genes near sites of elevated histone acetylation. A decrease in ACSS2 lowers nuclear acetyl-CoA levels, histone acetylation, and responsive expression of the cohort of neuronal genes. In adult mice, attenuation of hippocampal ACSS2 expression impairs long-term spatial memory, a cognitive process that relies on histone acetylation. A decrease in ACSS2 in the hippocampus also leads to defective upregulation of memory-related neuronal genes that are pre-bound by ACSS2. These results reveal a connection between cellular metabolism, gene regulation, and neural plasticity and establish a link between acetyl-CoA generation ‘on-site’ at chromatin for histone acetylation and the transcription of key neuronal genes. The metabolic enzyme acetyl coenzyme A synthetase directly regulates gene expression during memory formation by binding to specific genes and providing acetyl coenzyme A for histone acetylation. The regulation of neuronal gene transcription during memory formation involves histone acetylation, which is critical to long-term memory consolidation. Here, Shelley Berger and colleagues show that in neurons the metabolic enzyme acetyl coenzyme A synthetase 2 (ACSS2) associates with chromatin to increase local concentrations of acetyl coenzyme A and to promote histone acetylation and transcription of neural genes. In the mouse hippocampus, ACSS2 expression is required for the expression of neuronal genes involved in memory and the acquisition of long-term memories. These results reveal a direct role of a metabolic enzyme in acetylating histones and connect acetate metabolism to neuronal gene regulation and neural plasticity.