MADRID (AP) — Much of Spain is on alert as the country's weather agency warns that temperatures could surpass 40 degrees Celsius (104 Fahrenheit) due to a hot air mass moving north from Africa.

Spain's Meteorological Agency says eight provinces in the southern Andalusia region and around Madrid are under high risk because of the heat wave hitting the country beginning Wednesday.

Two dozen more provinces are also on a lower level of alert, with the agency saying that the mercury could hit 44 degrees Celsius (111 Fahrenheit) in three major river valleys on Thursday and Friday.

Authorities are warning against venturing outdoors during the peak sunny hours of the day and advising citizens to drink water and keep houses and vehicles as cool as possible.