The nature of ultrahigh-energy cosmic rays (UHECRs) at energies >1020eV remains a mystery. They are likely to be of extragalactic origin, but should be absorbed within ~50Mpc through interactions with the cosmic microwave background. As there are no sufficiently powerful accelerators within this distance from the Galaxy, explanations for UHECRs range from unusual astrophysical sources to exotic string physics. Also unclear is whether UHECRs consist of protons, heavy nuclei, neutrinos or γ-rays. To resolve these questions, larger detectors with higher duty cycles and which combine multiple detection techniques are needed. Radio emission from UHECRs, on the other hand, is unaffected by attenuation, has a high duty cycle, gives calorimetric measurements and provides high directional accuracy. Here we report the detection of radio flashes from cosmic-ray air showers using low-cost digital radio receivers. We show that the radiation can be understood in terms of the geosynchrotron effect. Our results show that it should be possible to determine the nature and composition of UHECRs with combined radio and particle detectors, and to detect the ultrahigh-energy neutrinos expected from flavour mixing.