Spain's earliest heatwave in over 40 years is causing extreme stress to the country's birds and leading baby birds, nesting in buildings, to fall out of their nests as they try to escape the high temperatures.

A team at a bird recovery centre in Madrid is treating scores of dehydrated and undernourished baby swifts that fell from their nests in building facades or roof cavities, after they tried to leave before they could properly fly.

"Birds are suffering especially in this very early heat wave in June that we are having in Spain," David Howell, climate and energy adviser at SEO Birdlife told Reuters.

"They suffer especially from heat stress and thirst and even in some cases they have to leave the nest to try to find cooler temperatures. For that reason during this period many chicks and nesting fledglings are (found) on the ground, just because they are trying to escape the excess heat."

The heatwave, which has coincided with the hatching season, is expected to last until the end of the week, with temperatures surpassing 40 Celsius (104 F) in many parts of Spain. Night temperatures are also unusually high at between 20 C and 25 C.

At Brinzal bird centre in Madrid's vast Casa de Campo country park, employees are hand rearing birds until they are able to fly. Then they are set free, coordinator Patricia Orejas told Reuters.