The latest bid to reduce emissions comes as the city battles acutely high pollution levels, partly due to little wind.
Under the ban, gas vehicles made before 2000 and diesel vehicles manufactured before 2006 were prohibited from the city centre and surrounding M-30 ring road until Thursday daytime, the city hall said.
Cars meeting these criteria account for 17 percent of Madrid's vehicles.
It is the first time that the city's authorities have activated stage two of its new anti-pollution protocol which came into effect in October.
In addition to this protocol, Madrid's left-wing city hall last month launched a separate traffic restriction scheme in the historic city centre, which aims to reduce gas emissions by 40 percent.
The move by Madrid follows other European cities like London, Stockholm and Milan that have taken steps to restrict traffic in their centres — although they have charged drivers to enter.
In the Spanish capital, on the other hand, drivers of the oldest and most polluting vehicles have been banned from accessing the centre altogether and will face fines in the future if they do so.
With 3.2 million residents and some 1.8 million cars, Madrid often suffers from high pollution levels.
Located on a high plateau where atmospheric conditions routinely trap dirty air close to the ground level when there is little wind, Madrid's smog is such a fixture that it has been given a nickname — “la boina” or “the beret”.
The city has attempted a number of initiatives in recent years, including in December 2016 when half of most private cars were ordered off the roads to fight a particularly bad bout of pollution.