The mechanisms that extend lifespan in humans are poorly understood. Here we show that extended longevity in humans is associated with a distinct transcriptome signature in the cerebral cortex that is characterized by downregulation of genes related to neural excitation and synaptic function. In Caenorhabditis elegans, neural excitation increases with age and inhibition of excitation globally, or in glutamatergic or cholinergic neurons, increases longevity. Furthermore, longevity is dynamically regulated by the excitatory-inhibitory balance of neural circuits. The transcription factor REST is upregulated in humans with extended longevity and represses excitation-related genes. Notably, REST-deficient mice exhibit increased cortical activity and neuronal excitability during ageing. Similarly, loss-of-function mutations in the C. elegans REST orthologue genes spr-3 and spr-4 elevate neural excitation and reduce the lifespan of long-lived daf-2 mutants. In wild-type worms, overexpression of spr-4 suppresses excitation and extends lifespan. REST, SPR-3, SPR-4 and reduced excitation activate the longevity-associated transcription factors FOXO1 and DAF-16 in mammals and worms, respectively. These findings reveal a conserved mechanism of ageing that is mediated by neural circuit activity and regulated by REST.