The ruling is a significant victory for campaigners, who launched legal action after the UK breached EU limits for nitrogen dioxide (NO2) in the air.
Diesel vehicles are a key source of NO2, which is linked to a range of respiratory illnesses.
A panel of five judges unanimously ruled that the Government “must prepare and consult on new air quality plans for submission to the European Commission... no later than December 31 2015".
Announcing the decision, lead judge, Lord Carnwath said: "The new government, whatever its political complexion, should be left in no doubt as to the need for immediate action to address this issue."