  The binary neutron star (BNS) merger GW170817 was the first astrophysical
source detected in gravitational waves and multi-wavelength electromagnetic
radiation. The almost simultaneous observation of a pulse of gamma-rays proved
that BNS mergers are associated with at least some short gamma-ray bursts
(GRBs). However, the gamma-ray pulse was faint, casting doubts on the
association of BNS mergers with the luminous, highly relativistic outflows of
canonical short GRBs. Here we show that structured jets with a relativistic,
energetic core surrounded by slower and less energetic wings produce afterglow
emission that brightens characteristically with time, as recently seen in the
afterglow of GW170817. Initially, we only see the relatively slow material
moving towards us. As time passes, larger and larger sections of the outflow
become visible, increasing the luminosity of the afterglow. The late appearance
and increasing brightness of the multi-wavelength afterglow of GW170817 allow
us to constrain the geometry of its ejecta and thus reveal the presence of an
off-axis jet pointing about 30 degrees away from Earth. Our results confirm a
single origin for BNS mergers and short GRBs: GW170817 produced a structured
outflow with a highly relativistic core and a canonical short GRB. We did not
see the bright burst because it was beamed away from Earth. However,
approximately one in 20 mergers detected in gravitational waves will be
accompanied by a bright, canonical short GRB.
