Intense, millisecond-duration bursts of radio waves (named fast radio bursts) have been detected from beyond the Milky Way1. Their dispersion measures—which are greater than would be expected if they had propagated only through the interstellar medium of the Milky Way—indicate extragalactic origins and imply contributions from the intergalactic medium and perhaps from other galaxies2. Although several theories exist regarding the sources of these fast radio bursts, their intensities, durations and temporal structures suggest coherent emission from highly magnetized plasma3,4. Two of these bursts have been observed to repeat5,6, and one repeater (FRB 121102) has been localized to the largest star-forming region of a dwarf galaxy at a cosmological redshift of 0.19 (refs. 7-9). However, the host galaxies and distances of the hitherto non-repeating fast radio bursts are yet to be identified. Unlike repeating sources, these events must be observed with an interferometer that has sufficient spatial resolution for arcsecond localization at the time of discovery. Here we report the localization of a fast radio burst (FRB 190523) to a few-arcsecond region containing a single massive galaxy at a redshift of 0.66. This galaxy is different from the host of FRB 121102, as it is a thousand times more massive, with a specific star-formation rate (the star-formation rate divided by the mass) a hundred times smaller.