Gamma-ray burst (GRB) afterglows probe sightlines to star-forming regions in distant star-forming galaxies. Here we present a study of the peculiar afterglow spectrum of the z=0.889 Swift GRB 140506A. Our aim is to understand the origin of the very unusual properties of the absorption along the line of sight. We analyse spectroscopic observations obtained with the X-shooter spectrograph mounted on the ESO/VLT at two epochs 8.8h and 33h after the burst, and with imaging from the GROND instrument. We also present imaging and spectroscopy of the host galaxy obtained with the Magellan telescope.