Madrid is set to go into partial lockdown after an order from the Spanish government, but is determined to fight it in the courts.
Measures that ban all non-essential trips in and out of the capital and nine of its suburbs — covering around 4.8 million people — are set to be enacted on Friday evening.
Spain’s Socialist prime minister, Pedro Sanchez, said there was a “critical” need to take the new steps in the European coronavirus hot spot.
It has filed an appeal at the National Court against the new measures.
Under the national order, travellers will need to prove they are going to or from work, to see a doctor or to conduct essential administrative or legal errands in order to leave Madrid or the town where they live.
Restaurants must close at 11pm and shops at 10pm, with a restriction of 50% capacity.
Similar measures already apply to more than a million residents, and the region has limited social gatherings to a maximum of six people.
Madrid’s legal challenge argues that restrictions violate regional self-rule laws.
The city is leading the resurgence of the virus in Spain, which has Europe’s highest cumulative caseload — 770,000 since the onset of the pandemic.
But Madrid regional health chief Enrique Ruiz Escudero said the situation is improving, with the infection rate falling to 607 per 100,000 on Friday and four consecutive days of fewer people being admitted to hospital.
“The numbers give us reason for hope,” he told a news conference.
Madrid legal chief Enrique Lopez said authorities will comply with the order, deploying more police, even though they believe it will “create chaos”.
He estimated the order will cost the Madrid economy 8 billion euros (£7.2 billion).
Mr Sanchez has refused to budge, saying Madrid faces “a moment of extraordinary seriousness”.
Some passengers at Madrid’s main train station, Atocha, welcomed the new steps.
“I think they need to take strong measures to control the epidemic here in Madrid,” said Vicente Mira, a 62-year-old retired teacher.
Communication manager Pablo Torres, 36, wanted officials to get tough, saying the current measures are “nonsense and a sticking plaster on something that is a lot bigger problem”.
It was not immediately clear how the new measures might affect the few tourists arriving in Madrid, but regional authorities cannot ban foreign visitors unless Spain closes its borders.