When a massive star explodes as a supernova, substantial amounts of radioactive elements--primarily 56Ni, 57Ni and 44Ti--are produced. After the initial flash of light from shock heating, the fading light emitted by the supernova is due to the decay of these elements. However, after decades, the energy powering a supernova remnant comes from the shock interaction between the ejecta and the surrounding medium. The transition to this phase has hitherto not been observed: supernovae occur too infrequently in the Milky Way to provide a young example, and extragalactic supernovae are generally too faint and too small. Here we report observations that show this transition in the supernova SN 1987A in the Large Magellanic Cloud. From 1994 to 2001, the ejecta faded owing to radioactive decay of 44Ti as predicted. Then the flux started to increase, more than doubling by the end of 2009. We show that this increase is the result of heat deposited by X-rays produced as the ejecta interacts with the surrounding material. In time, the X-rays will penetrate farther into the ejecta, enabling us to analyse the structure and chemistry of the vanished star.