Over the past five years evidence has mounted that long-duration (> 2 s) gamma-ray bursts (GRBs)--the most brilliant of all astronomical explosions--signal the collapse of massive stars in our Universe. This evidence was originally based on the probable association of one unusual GRB with a supernova, but now includes the association of GRBs with regions of massive star formation in distant galaxies, the appearance of supernova-like bumps in the optical afterglow light curves of several bursts and lines of freshly synthesized elements in the spectra of a few X-ray afterglows. These observations support, but do not yet conclusively demonstrate, the idea that long-duration GRBs are associated with the deaths of massive stars, presumably arising from core collapse. Here we report evidence that a very energetic supernova (a hypernova) was temporally and spatially coincident with a GRB at redshift z = 0.1685. The timing of the supernova indicates that it exploded within a few days of the GRB, strongly suggesting that core-collapse events can give rise to GRBs, thereby favouring the collapsar model.