About ten per cent of the known extrasolar planets are gas giants that orbit very close to their parent stars. The atmospheres of these `hot Jupiters' are heated by the immense stellar irradiation. In the case of the planet HD 209458b, this energy deposition results in a hydrodynamic state in the upper atmosphere, allowing for sizeable expansion and escape of neutral hydrogen gas. HD 209458b was the first extrasolar planet discovered that transits in front of its parent star. The size of the planet can be measured using the total optical obscuration of the stellar disk during an observed transit, and the structure and composition of the planetary atmosphere can be studied using additional planetary absorption signatures in the stellar spectrum. Here we report the detection of absorption by hot hydrogen in the atmosphere of HD 209458b. Previously, the lower atmosphere and the full extended upper atmosphere of HD 209458b have been observed, whereas here we probe a layer where the escaping gas forms in the upper atmosphere of HD 209458b.