Firefighters battled to contain a fast-spreading wildfire north of Spain's capital, Madrid, on Sunday.