Red giants are evolved stars that have exhausted the supply of hydrogenin their cores and instead burn hydrogen in a surrounding shell(1,2). Once a red giant is sufficiently evolved, the helium in the core also undergoes fusion(3). Outstanding issues in our understanding of red giants include uncertainties in the amount of mass lost at the surface before helium ignition and the amount of internal mixing from rotation and other processes(4). Progress is hampered by our inability to distinguish between red giants burning helium in the core and those still only burning hydrogen in a shell. Asteroseismology offers a way forward, being a powerful tool for probing the internal structures of stars using their natural oscillation frequencies(5). Here we report observations of gravity-mode period spacings in red giants(6) that permit a distinction between evolutionary stages to be made. We use high-precision photometry obtained by the Kepler spacecraft over more than a year to measure oscillations in several hundred red giants. We find many stars whose dipole modes show sequences with approximately regular period spacings. These stars fall into two clear groups, allowing us to distinguish unambiguously between hydrogen-shell-burning stars (period spacing mostly similar to 50 seconds) and those that are also burning helium (period spacing similar to 100 to 300 seconds).