Postnatal maturation of cardiomyocytes is characterized by a metabolic switch from glycolysis to fatty acid oxidation, chromatin reconfiguration and exit from the cell cycle, instating a barrier for adult heart regeneration1,2. Here, to explore whether metabolic reprogramming can overcome this barrier and enable heart regeneration, we abrogate fatty acid oxidation in cardiomyocytes by inactivation of Cpt1b. We find that disablement of fatty acid oxidation in cardiomyocytes improves resistance to hypoxia and stimulates cardiomyocyte proliferation, allowing heart regeneration after ischaemia–reperfusion injury. Metabolic studies reveal profound changes in energy metabolism and accumulation of α-ketoglutarate in Cpt1b-mutant cardiomyocytes, leading to activation of the α-ketoglutarate-dependent lysine demethylase KDM5 (ref. 3). Activated KDM5 demethylates broad H3K4me3 domains in genes that drive cardiomyocyte maturation, lowering their transcription levels and shifting cardiomyocytes into a less mature state, thereby promoting proliferation. We conclude that metabolic maturation shapes the epigenetic landscape of cardiomyocytes, creating a roadblock for further cell divisions. Reversal of this process allows repair of damaged hearts.