From around 2020, town halls will be allowed to levy extra charges on diesel drivers using the UK's 81 most polluted routes if air quality fails to improve.
Diesels might even be banned at peak times. Judges ruled the Government was breaking the law by allowing concentrations of nitrogen dioxide to build up in urban areas.
ClientEarth, an environmental law organisation, argued successfully that ministers were not doing enough to tackle the issue.
A judge ordered ministers to unveil the new air quality strategy to cut illegal levels of pollution from diesel vehicles by next Monday.
The Government also faces fines from the European Commission, which has sent Britain a final warning to comply with EU air pollution limits for NO2 or face a case at the European Court of Justice.
Any suggestion that drivers of diesels should be penalised will be greeted with anger from motoring organisations. They point out that the last Labour government had encouraged people to buy the vehicles.
It was thought that efficient diesel engines were the best way to cut greenhouse gas emissions. It later emerged that the nitrogen dioxide they emit was harming air quality.
Levels have been above legal limits in almost 90 per cent of urban areas in the UK since 2010.
The toxic fumes are estimated to cause 23,500 early deaths a year and the problem was declared a public health emergency by a cross-party committee last year.
New guidance to councils will see them urged to introduce a range of measures to bring down pollution.
These include making buses more environmentally-friendly, changing the phasing of traffic lights, removing speed bumps and changing road layouts. Town halls will be told to do all they can to avoid hitting diesel drivers, who bought the cars in good faith, with punitive measures.
But if these do not work, the Government will allow town halls to charge drivers of the dirtiest vehicles using the most polluted roads.
They could also restrict the times of day when they can use these roads - banning them during peak hours, for example. Town halls will not be allowed to bring in city-wide restrictions. They will only be able to take action on the 81 most polluted roads in the country.
A Government spokesman said: 'Our plan to deal with dirty diesels will help councils clean up emissions hotspots - often a single road - through common sense measures which do not unfairly penalise ordinary working people.
"Diesel drivers are not to blame and to help them switch to cleaner vehicles the Government will consult on a targeted scrappage scheme - one of a number of measures to support motorists affected by local plans.
"Overall we are investing £3billion to tackle the effects of roadside pollution and supporting greener transport initiatives."
The clean air plan will be unveiled by Gove's Department for Environment, Food and Rural Affairs and Grayling's Department for Transport. The Government said poor air quality was the largest environmental risk to public health
Evidence from the World Health Organisation shows that older people, children, people with pre-existing lung and heart conditions, and people on lower incomes may be most at risk, a spokesman said.
Gove will tell councils to concentrate its action to reduce emissions on some of the busiest roads and junctions. Analysis of more than 1,800 of Britain's major roads by the government's Joint Air Quality Unit shows that 81 - 4 per cent - are affected, with 33 roads outside London.
In many areas - including Nottingham, Bolton, Bristol, Cardiff and Middlesbrough - a single road is affected. Although ministers have not ruled out charging and restricting access to polluting cars at the busiest times, they want town halls to exhaust all other options first. An extra £255million will be given to councils to help them bring in the plans, which will have to be drawn up by the end of 2018.
The Government will also invest money in a Clean Air Fund. Councils will be able to bid for money to support improvements that avoid the need for restrictions on polluting vehicles. But ministers accepted that if this did not succeed in reducing emissions, councils may need to consider restrictions on polluting vehicles using affected roads.
It could mean preventing polluting vehicles using some of the roads at certain times of the day - or introducing charging, as London mayor Sadiq Khan has announced.
A source said: "The Government is clear that local authorities should exhaust other options before opting to hit drivers with new charges for using vehicles they bought in good faith. 'Any restrictions or charging on polluting vehicles should be time-limited and lifted as soon as air pollution is within legal limits and the risk of future beaches has passed. A consultation will also be launched in the autumn on mitigation measures including a possible scrappage scheme to support drivers affected by any restrictions on polluting vehicles."
Last week a cross-party group of MPs wrote to Mr Gove demanded restricted access for polluting vehicles in urban areas.
BMW delivered a vote of confidence in post-Brexit Britain yesterday as it pledged to build the electric Mini here.
Having previously warned it could move production to the Netherlands, the German car giant revealed the next generation of the car will be assembled at its historic home in Cowley, Oxford.
The first fully electric Mini E will roll off the production line in 2019, just as Britain cuts ties with the EU.
The electric drivetrain - the components that transfer power from the transmission to the wheels - will be built in Germany, before being shipped to the UK.
Bosses at BMW had told shareholders that the electric Mini could be manufactured at its smaller plant in the Netherlands, as they ratcheted up pressure on ministers to thrash out a favourable deal for the car industry in Brexit negotiations.
There had also been mounting speculation that the firm would build a plant in Germany.
But yesterday BMW became the latest international carmaker to back Britain, with Nissan, Jaguar Land Rover and Toyota all revealing plans to ramp up production and invest in their UK car plants.
It also became the latest manufacturer to outline plans to boost production of electric cars. BMW said it would be able to offer a fully electric version of any new model of BMW or Mini launched from 2020, if there was enough demand.
Tory MPs last night described the firm's decision as a "clear endorsement" of British car manufacturing, its workforce and its long term economic prospects.
It is also a boost to the 4,500 workers who churn out around 1,000 Minis a day at the 100-acre plant. BMW employs 24,000 staff in the UK, from the factory floor to its dealerships, including the Rolls-Royce factory in Sussex, and other plants in Birmingham and Swindon.
Business secretary Greg Clark, who is said to have met BMW board member Ian Robertson four times this year, said: 'This landmark decision is a vote of confidence in the determination of our industrial strategy to make Britain the go-to place in the world for the next generation of vehicles.
"BMW's decision recognises the strength of the excellent workforce, our record of innovation and the productive relationship between the automotive sector and the Government. The automotive industry is a great British success story and the Mini is a big part of that."
BMW's move comes after a string of dire warnings from the car industry about the damage from Brexit.
The motor trade body the SMMT has described leaving the EU without a free trade deal as the biggest "threat to the car industry for a generation", amid fears that hefty tariffs will be imposed. Car makers have warned that the prospect of tariffs could push up the cost of manufacturing, forcing them to increase their prices.
With 80 per cent of the 1.7million cars built in the UK exported - mainly to the EU - some are worried that plants in the UK will no longer be able to compete.
Last night pro-Brexit MPs and City experts said common sense had prevailed. Sir Bill Cash, Tory MP for Stone, said: "The doomsayers and the prophets of fear are being given a lesson in practical common sense. This is an extremely important endorsement of the British workforce, and British car making."
Charlie Elphicke, Conservative MP for Dover and Deal and a supporter of the Change Britain campaign group, said: "The fact that this iconic car will be built in Britain is a huge vote of confidence in the UK economy and great news for British jobs.
"This is yet further evidence that Britain remains an attractive place to invest, with companies looking to develop the technologies of tomorrow here in the UK today."
David Buik, a veteran City commentator who works for stockbroker Panmure Gordon, said: "We're the second largest car assembly country in Europe for good reason. There is absolutely no need to move production elsewhere as we have the innovation, skills, driver and zest to take on all comers."
BMW said that it was committed to selling 100,000 electrified vehicles - hybrids or electric cars - this year, as many as it has sold in total since production started four years ago.