The adult mammalian heart possesses little regenerative potential following injury. Fibrosis due to activation of cardiac fibroblasts impedes cardiac regeneration and contributes to loss of contractile function, pathological remodelling and susceptibility to arrhythmias. Cardiac fibroblasts account for a majority of cells in the heart and represent a potential cellular source for restoration of cardiac function following injury through phenotypic reprogramming to a myocardial cell fate. Here we show that four transcription factors, GATA4, HAND2, MEF2C and TBX5, can cooperatively reprogram adult mouse tail-tip and cardiac fibroblasts into beating cardiac-like myocytes in vitro. Forced expression of these factors in dividing non-cardiomyocytes in mice reprograms these cells into functional cardiac-like myocytes, improves cardiac function and reduces adverse ventricular remodelling following myocardial infarction. Our results suggest a strategy for cardiac repair through reprogramming fibroblasts resident in the heart with cardiogenic transcription factors or other molecules. A combination of four transcription factors, GATA4, HAND2, MEF2C and TBX5, can reprogram fibroblasts into cardiac-like myocytes in vitro and in vivo; expression of these factors ameliorated cardiac function in mice that had suffered myocardial infarction. The neonatal mammalian heart can regenerate following injury, but adult mammalian hearts have limited capacity for regeneration. Here Eric Olson and colleagues show that a cocktail of four transcription factors — GATA4, HAND2, MEF2C and TBX5 — can reprogram adult fibroblasts into cardiomyocytes in vitro. They then take the same approach in vivo, using a retrovirus to deliver the transcription factors to the hearts of mice and demonstrate that expression of these four transcription factors reprograms non-myocytes to cardiomocytes and attenuates cardiac dysfunction after myocardial infarction.