Helium is the second-most abundant element in the Universe after hydrogen and is one of the main constituents of gas-giant planets in our Solar System. Early theoretical models predicted helium to be among the most readily detectable species in the atmospheres of exoplanets, especially in extended and escaping atmospheres 1 . Searches for helium, however, have hitherto been unsuccessful 2 . Here we report observations of helium on an exoplanet, at a confidence level of 4.5 standard deviations. We measured the near-infrared transmission spectrum of the warm gas giant 3 WASP-107b and identified the narrow absorption feature of excited metastable helium at 10,833 angstroms. The amplitude of the feature, in transit depth, is 0.049 ± 0.011 per cent in a bandpass of 98 angstroms, which is more than five times greater than what could be caused by nominal stellar chromospheric activity. This large absorption signal suggests that WASP-107b has an extended atmosphere that is eroding at a total rate of 1010 to 3 × 1011 grams per second (0.1-4 per cent of its total mass per billion years), and may have a comet-like tail of gas shaped by radiation pressure.