Our understanding of the evolution of massive stars before their final explosions as supernovae is incomplete, from both an observational and a theoretical standpoint. A key missing piece in the supernova puzzle is the difficulty of identifying and studying progenitor stars. In only a single case-that of supernova SN 1987A in the Large Magellanic Cloud-has a star been detected at the supernova location before the explosion, and been subsequently shown to have vanished after the supernova event. The progenitor of SN 1987A was a blue supergiant, which required a rethink of stellar evolution models. The progenitor of supernova SN 2005gl was proposed to be an extremely luminous object, but the association was not robustly established (it was not even clear that the putative progenitor was a single luminous star). Here we report that the previously proposed object was indeed the progenitor star of SN 2005gl. This very massive star was likely a luminous blue variable that standard stellar evolution predicts should not have exploded in that state.