Since their identification with cosmological distances, Gamma-ray bursts (GRBs) have been recognised as the most energetic phenomena in the Universe, with an isotropic burst energy as high as 10^54 ergs. However, the progenitors responsible for the bursts remain elusive, favoured models ranging from a neutron star binary merger, to the collapse of a massive star. Crucial to our understanding of the origins of GRBs is the study of the afterglow emission, where spectroscopy can reveal details of the environment of the burst. Here we report on an XMM-Newton observation of the X-ray afterglow of GRB 011211. The X-ray spectrum reveals evidence for emission lines of Magnesium, Silicon, Sulphur, Argon, Calcium, and possibly Nickel, arising in enriched material with an outflow velocity of order 0.1c. This is the first direct measurement of outflowing matter in a gamma ray burst. The observations strongly favour models where a supernova explosion from a massive stellar progenitor precedes the burst event and is responsible for the outflowing matter.