Spain was among five member states to be issued the ultimatum for failing to address repeated breaches of air pollution limits for nitrogen dioxide (NO2), emissions that are mostly caused by road traffic.
Spain has three “air quality zones” that persistently breach NO2 limits, two in Barcelona and one in Madrid.
Air pollution causes an estimated 30,000 premature deaths in Spain each year according to a report published by the European Environment Agency (EEA) in November.
Spain, along with Germany, France, the UK and Italy, must show how it intends to comply with EU law within two months, or face a court hearing with the power to impose heavy fines.
Madrid has recently implemented measures that include a partial ban on private cars from the city centre when pollution reaches dangerous levels.