During the dawn of chemistry1,2, when the temperature of the young Universe had fallen below some 4,000 kelvin, the ions of the light elements produced in Big Bang nucleosynthesis recombined in reverse order of their ionization potential. With their higher ionization potentials, the helium ions He2+ and He+ were the first to combine with free electrons, forming the first neutral atoms; the recombination of hydrogen followed. In this metal-free and low-density environment, neutral helium atoms formed the Universe’s first molecular bond in the helium hydride ion HeH+ through radiative association with protons. As recombination progressed, the destruction of HeH+ created a path to the formation of molecular hydrogen. Despite its unquestioned importance in the evolution of the early Universe, the HeH+ ion has so far eluded unequivocal detection in interstellar space. In the laboratory the ion was discovered3 as long ago as 1925, but only in the late 1970s was the possibility that HeH+ might exist in local astrophysical plasmas discussed4,5,6,7. In particular, the conditions in planetary nebulae were shown to be suitable for producing potentially detectable column densities of HeH+. Here we report observations, based on advances in terahertz spectroscopy8,9 and a high-altitude observatory10, of the rotational ground-state transition of HeH+ at a wavelength of 149.1 micrometres in the planetary nebula NGC 7027. This confirmation of the existence of HeH+ in nearby interstellar space constrains our understanding of the chemical networks that control the formation of this molecular ion, in particular the rates of radiative association and dissociative recombination.