Lightning and thunderclouds are natural particle accelerators. Avalanches of relativistic runaway electrons, which develop in electric fields within thunderclouds, emit bremsstrahlung γ-rays. These γ-rays have been detected by ground-based observatories, by airborne detectors and as terrestrial γ-ray flashes from space. The energy of the γ-rays is sufficiently high that they can trigger atmospheric photonuclear reactions that produce neutrons and eventually positrons via β+ decay of the unstable radioactive isotopes, most notably 13N, which is generated via 14N + γ → 13N + n, where γ denotes a photon and n a neutron. However, this reaction has hitherto not been observed conclusively, despite increasing observational evidence of neutrons and positrons that are presumably derived from such reactions. Here we report ground-based observations of neutron and positron signals after lightning. During a thunderstorm on 6 February 2017 in Japan, a γ-ray flash with a duration of less than one millisecond was detected at our monitoring sites 0.5-1.7 kilometres away from the lightning. The subsequent γ-ray afterglow subsided quickly, with an exponential decay constant of 40-60 milliseconds, and was followed by prolonged line emission at about 0.511 megaelectronvolts, which lasted for a minute. The observed decay timescale and spectral cutoff at about 10 megaelectronvolts of the γ-ray afterglow are well explained by de-excitation γ-rays from nuclei excited by neutron capture. The centre energy of the prolonged line emission corresponds to electron-positron annihilation, providing conclusive evidence of positrons being produced after the lightning.