MADRID — At least 35 people have been killed and dozens more injured by wildfires in Portugal and northern Spain, as strong winds from a hurricane fanned hundreds of blazes sweeping across densely forested territory.

The authorities in Portugal declared a state of emergency in affected areas over the weekend, when about 500 fires were reported in the central and northern regions, and they raised the death toll to 31. About 4,000 firefighters were working to extinguish at least 65 blazes Monday morning.

Across the border in Spain, fires reached the outskirts of the port city of Vigo, forcing the temporary closing of a car factory. Television news reports and videos shared on social media showed residents forming human chains to pass water buckets in order to help put out flames.

The Spanish authorities said that more than 90 fires were burning in the northern regions of Galicia and Asturias. Prime Minister Mariano Rajoy, who is from Galicia, traveled on Monday to his home region, where the authorities confirmed that at least four people had died.