Fast radio bursts (FRBs) are flashes of unknown physical origin1. The majority of FRBs have been seen only once, although some are known to generate multiple flashes2,3. Many models invoke magnetically powered neutron stars (magnetars) as the source of the emission4,5. Recently, the discovery6 of another repeater (FRB 20200120E) was announced, in the direction of the nearby galaxy M81, with four potential counterparts at other wavelengths6. Here we report observations that localized the FRB to a globular cluster associated with M81, where it is 2 parsecs away from the optical centre of the cluster. Globular clusters host old stellar populations, challenging FRB models that invoke young magnetars formed in a core-collapse supernova. We propose instead that FRB 20200120E originates from a highly magnetized neutron star formed either through the accretion-induced collapse of a white dwarf, or the merger of compact stars in a binary system7. Compact binaries are efficiently formed inside globular clusters, so a model invoking them could also be responsible for the observed bursts.