X-ray free-electron lasers can generate intense and coherent radiation at wavelengths down to the sub-ångström region1,2,3,4,5, and have become indispensable tools for applications in structural biology and chemistry, among other disciplines6. Several X-ray free-electron laser facilities are in operation2,3,4,5; however, their requirement for large, high-cost, state-of-the-art radio-frequency accelerators has led to great interest in the development of compact and economical accelerators. Laser wakefield accelerators can sustain accelerating gradients more than three orders of magnitude higher than those of radio-frequency accelerators7,8,9,10, and are regarded as an attractive option for driving compact X-ray free-electron lasers11. However, the realization of such devices remains a challenge owing to the relatively poor quality of electron beams that are based on a laser wakefield accelerator. Here we present an experimental demonstration of undulator radiation amplification in the exponential-gain regime by using electron beams based on a laser wakefield accelerator. The amplified undulator radiation, which is typically centred at 27 nanometres and has a maximum photon number of around 1010 per shot, yields a maximum radiation energy of about 150 nanojoules. In the third of three undulators in the device, the maximum gain of the radiation power is approximately 100-fold, confirming a successful operation in the exponential-gain regime. Our results constitute a proof-of-principle demonstration of free-electron lasing using a laser wakefield accelerator, and pave the way towards the development of compact X-ray free-electron lasers based on this technology with broad applications.