Madrid banned most petrol and diesel cars from the heart of the city today as it tries to improve the air quality, in what is one of Europe's most polluted capitals.

Police patrolled dozens of access points to the almost 5sq/km area - including the Gran Via avenue and Puerta del Sol square teeming with tourists - to block all cars except those with exemptions, or that were electric or hybrid-powered.

Grinding traffic jams and a lot of older or diesel vehicles - plus a frequently windless dry climate - have contributed to the high levels of nitrogen dioxide in Madrid that have been in violation of European regulations since 2010.

Madrid authorities hope to catch up with other European capitals such as London, Paris, Berlin and Oslo that are already imposing traffic restrictions to improve the air quality.

However, the plan may fall apart before it is fully implemented if the conservative opposition Popular Party, which argues that the administrative procedure of adopting the new rules was flawed, has its way after challenging it in court.

Ines Sabanes, in charge of Environment and Mobility at the Madrid City Hall, said the city would press ahead with anti-pollution measures.

"We can't afford it (inversion of environment policies), neither can the cities, nor the health of the planet," she said.

Traffic was heavy around the perimeter of the new exclusion zone, with cars honking loudly, but it was little different from any other day as cars without the permits appeared to steer clear of the area.

Critics say the rules have multiple, complex exceptions that could undermine the plan's efficiency.

For instance, residents of the central area can drive any kind of cars, including older diesel cars, and so can property owners even if they are not residents. All motorcycles are allowed during day-time.

Police will enforce the restrictions for the first few months without applying fines, but in March a computer system is due to fully assume control and fine potential violators.