Emergency services battled several wildfires Sunday in northern Spain as an unseasonable heatwave that gripped the country for the past week finally eased.

The most alarming blaze in the northwestern Sierra de Culebra mountain range has already destroyed over 25,000 hectares (62,000 acres), the regional government said.

It started on Wednesday during a dry thunderstorm but firefighters said cooler overnight temperatures had helped them make gains in their battle against the flames.

Residents of some 20 villages who were evacuated from their homes were allowed to return home Sunday morning due to the improved situation, local officials said.

Several roads reopened and a high-speed rail link between Madrid and the northwestern region of Galicia, which was closed Saturday due to the blaze, reopened, they added.

Elsewhere in Spain, smaller wildfires were also raging in the northwestern region of Catalonia and the northern Navarra region, one of the few areas of Spain where temperatures remained unusually high Sunday.

The regional government of Navarra urged residents to avoid "unnecessary travel" to keep roads free for fire crews.

"We have a very difficult few hours ahead of us," the director of Navarra's interior ministry, Amparo Lopez Antelo, told reporters.

The battle against the blaze was hindered by high temperatures and southerly wind gusts of over 30 kilometres (18 miles) an hour, she added.

Temperatures of more than 40 degrees Celsius (104 degrees Fahrenheit) have been recorded in many cities and other areas throughout the week but they dropped Sunday in most of the country.

The mercury was only expected to hit 29 degrees Celsius in Madrid on Sunday and 25 degrees in the province of Zamora where the Sierra de Culebra mountain range is located.