  GW170817/GRB170817A has offered unprecedented insight into binary neutron
star post-merger systems. Its Prompt and afterglow emission imply the presence
of a tightly collimated relativistic jet with a smooth transverse structure.
However, it remains unclear whether and how the central engine can produce such
structured jets. Here, we utilize 3D GRMHD simulations starting with a black
hole surrounded by a magnetized torus with properties typically expected of a
post-merger system. We follow the jet, as it is self-consistently launched,
from the scale of the compact object out to more than 3 orders of magnitude in
distance. We find that this naturally results in a structured jet, which is
collimated by the disk wind into a half-opening angle of roughly 10 degrees,
its emission can explain features of both the prompt and afterglow emission of
GRB170817A for a 30 degree observing angle. Our work is the first to compute
the afterglow, in the context of a binary merger, from a relativistic
magnetized jet self-consistently generated by an accreting black hole, with the
jet's transverse structure determined by the accretion physics and not
prescribed at any point.
