The origin of γ-ray bursts (GRBs) has been enigmatic since their discovery. The situation improved dramatically in 1997, when the rapid availability of precise coordinates, for the bursts allowed the detection of faint optical and radio afterglows - optical spectra thus obtained have demonstrated conclusively that the bursts occur at cosmological distances. But, despite efforts by several groups, optical detection has not hitherto been achieved during the brief duration of a burst. Here we report the detection of bright optical emission from GRB990123 while the burst was still in progress. Our observations begin 22 seconds after the onset of the burst and show an increase in brightness by a factor of 14 during the first 25 seconds; the brightness then declines by a factor of 100, at which point (700 seconds after the burst onset) it falls below our detection threshold. The redshift of this burst, z ~ 1.6 (refs 8, 9), implies a peak optical luminosity of 5× 1049ergs-1. Optical emission from γ-ray bursts has been generally thought to take place at the shock fronts generated by interaction of the primary energy source with the surrounding medium, where the γ-rays might also be produced. The lack of a significant change in the γ-ray light curve when the optical emission develops suggests that the γ-rays are not produced at the shock front, but closer to the site of the original explosion.