GRS 1915+1051 was the first stellar-mass black-hole in our Galaxy to display a superluminal radio jet2, similar to those observed in active galactic nuclei with a supermassive black hole at the centre3. It has been proposed that the radio emission in GRS 1915+105 is fed by instabilities in the accretion disc4 by which the inner parts of the accretion flow is ejected in the jet5–7. Here we show that there is a significant correlation between: (i) the radio flux, coming from the jet, and the flux of the iron emission line, coming from the disc and, (ii) the temperature of the corona that produces the high-energy part of the X-ray spectrum via inverse Compton scattering and the amplitude of a high-frequency variability component coming from the innermost part of the accretion flow. At the same time, the radio flux and the flux of the iron line are strongly anti-correlated with the temperature of the X-ray corona and the amplitude of the high-frequency variability component. These correlations persist over ~10 years, despite the highly variable X-ray and radio properties of the source in that period8,9. Our findings provide, for the first time, incontrovertible evidence that the energy that powers this black-hole system can be directed either to the X-ray corona or the jet. When this energy is used to power the corona, raising its temperature, there is less energy left to fuel the jet and the radio flux drops, and vice versa. These facts, plus the modelling of the variability in this source show conclusively that in GRS 1915+105 the X-ray corona morphs into the jet.