Fast radio bursts (FRBs) are brief, bright, extragalactic radio flashes1,2. Their physical origin remains unknown, but dozens of possible models have been postulated3. Some FRB sources exhibit repeat bursts4-7. Although over a hundred FRB sources have been discovered8, only four have been localized and associated with a host galaxy9-12, and just one of these four is known to emit repeating FRBs9. The properties of the host galaxies, and the local environments of FRBs, could provide important clues about their physical origins. The first known repeating FRB, however, was localized to a low-metallicity, irregular dwarf galaxy, and the apparently non-repeating sources were localized to higher-metallicity, massive elliptical or star-forming galaxies, suggesting that perhaps the repeating and apparently non-repeating sources could have distinct physical origins. Here we report the precise localization of a second repeating FRB source6, FRB 180916.J0158+65, to a star-forming region in a nearby (redshift 0.0337 ± 0.0002) massive spiral galaxy, whose properties and proximity distinguish it from all known hosts. The lack of both a comparably luminous persistent radio counterpart and a high Faraday rotation measure6 further distinguish the local environment of FRB 180916.J0158+65 from that of the single previously localized repeating FRB source, FRB 121102. This suggests that repeating FRBs may have a wide range of luminosities, and originate from diverse host galaxies and local environments.