  Fast radio bursts are astronomical radio flashes of unknown physical nature
with durations of milliseconds. Their dispersive arrival times suggest an
extragalactic origin and imply radio luminosities orders of magnitude larger
than any other kind of known short-duration radio transient. Thus far, all FRBs
have been detected with large single-dish telescopes with arcminute
localizations, and attempts to identify their counterparts (source or host
galaxy) have relied on contemporaneous variability of field sources or the
presence of peculiar field stars or galaxies. These attempts have not resulted
in an unambiguous association with a host or multi-wavelength counterpart. Here
we report the sub-arcsecond localization of FRB 121102, the only known
repeating burst source, using high-time-resolution radio interferometric
observations that directly image the bursts themselves. Our precise
localization reveals that FRB 121102 originates within 100 mas of a faint 180
uJy persistent radio source with a continuum spectrum that is consistent with
non-thermal emission, and a faint (25th magnitude) optical counterpart. The
flux density of the persistent radio source varies by tens of percent on day
timescales, and very long baseline radio interferometry yields an angular size
less than 1.7 mas. Our observations are inconsistent with the fast radio burst
having a Galactic origin or its source being located within a prominent
star-forming galaxy. Instead, the source appears to be co-located with a
low-luminosity active galactic nucleus or a previously unknown type of
extragalactic source. [Truncated] If other fast radio bursts have similarly
faint radio and optical counterparts, our findings imply that direct
sub-arcsecond localizations of FRBs may be the only way to provide reliable
associations.
