Future climate warming is expected to enhance plant growth in temperate ecosystems and to increase carbon sequestration. But although severe regional heatwaves may become more frequent in a changing climate, their impact on terrestrial carbon cycling is unclear. Here we report measurements of ecosystem carbon dioxide fluxes, remotely sensed radiation absorbed by plants, and country-level crop yields taken during the European heatwave in 2003. We use a terrestrial biosphere simulation model to assess continental-scale changes in primary productivity during 2003, and their consequences for the net carbon balance. We estimate a 30 per cent reduction in gross primary productivity over Europe, which resulted in a strong anomalous net source of carbon dioxide (0.5 Pg C yr(-1)) to the atmosphere and reversed the effect of four years of net ecosystem carbon sequestration. Our results suggest that productivity reduction in eastern and western Europe can be explained by rainfall deficit and extreme summer heat, respectively. We also find that ecosystem respiration decreased together with gross primary productivity, rather than accelerating with the temperature rise. Model results, corroborated by historical records of crop yields, suggest that such a reduction in Europe's primary productivity is unprecedented during the last century. An increase in future drought events could turn temperate ecosystems into carbon sources, contributing to positive carbon-climate feedbacks already anticipated in the tropics and at high latitudes.