Long-lived emission, known as afterglow, has now been detected from about a dozen gamma-ray bursts. Distance determinations place the bursts at cosmological distances, with redshifts,z, ranging from similar to 1 to 3, The energy required to produce these bright gamma-ray flashes is enormous: up to similar to 10(53) erg, or to per cent of the rest-mass energy of a neutron star, if the emission is isotropic. Here we present optical and near-infrared observations of the afterglow of GRB990123, and we determine a redshift of z greater than or equal to 1.6, This is to date the brightest gamma-ray burst with a well-localized position and if the gamma-rays were emitted isotropically, the energy release exceeds the rest-mass energy of a neutron st ar, so challenging current theoretical models of the sources. We argue, however, that our data may provide evidence of beamed (rather than isotropic) radiation, thereby reducing the total energy released to a lever where stellar-death models are still tenable.