Fast radio bursts (FRBs) are brief radio emissions from distant astronomical sources. Some are known to repeat, but most are single bursts. Nonrepeating FRB observations have had insufficient positional accuracy to localize them to an individual host galaxy. We report the interferometric localization of the single-pulse FRB 180924 to a position 4 kiloparsecs from the center of a luminous galaxy at redshift 0.3214. The burst has not been observed to repeat. The properties of the burst and its host are markedly different from those of the only other accurately localized FRB source. The integrated electron column density along the line of sight closely matches models of the intergalactic medium, indicating that some FRBs are clean probes of the baryonic component of the cosmic web.