Gamma-ray bursts (GRBs) are thought to result from the interaction of an extremely relativistic outflow interacting with a small amount of material surrounding the site of the explosion. Multi-wavelength observations covering the gamma-ray to radio wavebands allow investigations of this `fireball model. On 23 January 1999 optical emission was detected while the gamma-ray burst was still underway. Here we report the results of gamma-ray, optical/infra-red, sub-mm, mm and radio observations of this burst and its afterglow, which indicate that the prompt and afterglow emissions from GRB 990123 are associated with three distinct regions in the fireball. The afterglow one day after the burst has a much lower peak frequency than those of previous bursts; this explains the short-lived nature of the radio emission, which is not expected to reappear. We suggest that such differences reflect variations in the magnetic-field strengths in the afterglow emitting regions.