Long-duration gamma-ray bursts (GRBs) are thought to result from the explosions of certain massive stars, and some are bright enough that they should be observable out to redshifts of z > 20 using current technology. Hitherto, the highest redshift measured for any object was z = 6.96, for a Lyman-alpha emitting galaxy. Here we report that GRB 090423 lies at a redshift of z approximately 8.2, implying that massive stars were being produced and dying as GRBs approximately 630 Myr after the Big Bang. The burst also pinpoints the location of its host galaxy.