Thousands protested at the city's decision to reverse car pollution restrictions a week ago.
Vehicles entering certain parts of central Madrid will, from today, be fined.
It comes just one week after the low emission zone policy was suspended by the city's new conservative mayor.
Now a judge has overruled the mayor saying "the health of Madrid" is more important than "the right to travel by car."
The ban was originally introduced by Madrid's former left-wing mayor last November.
But the centre-right People's Party scrapped it, saying it hurt businesses and restricted movement.
They suspended fines on cars entering the currently restricted area of around 5 sq km (2 sq miles) from July 1, while it reviewed the plan to make it "compatible with citizens' mobility needs".
The measure came despite soaring global environmental concerns and is a fresh sign of growing divisions in Spain after a series of inconclusive elections in April and May.
It provoked protests across the Spanish capital, with people fearful that environmental rollbacks seen in the United States may be spreading to Europe.
Environmental groups including Greenpeace said the ban - known as "Madrid Central" - slashed air pollution levels from car emissions in the centre to record lows, as much as halving pollution in some areas.
The European Commission warned Spain that it would face sanctions and a possible lawsuit in the Court of Justice of the European Union if it fails to meet air quality standards in its largest cities of Madrid and Barcelona.
WATCH: Euronews' Jaime Velazquez is in central Madrid this morning and says there's a bit of confusion amongst drivers as to what's going on: