The Spanish government has ordered a partial lockdown in the capital Madrid and surrounding areas badly affected by coronavirus after a rise in cases.
Under the new restrictions, residents will not be allowed to leave the area unless they have to make an essential journey.
However, Madrid's regional government says the lockdown is not legally valid.
Greater Madrid accounts for more than a third of the 133,604 cases diagnosed in Spain over the past two weeks.
On Wednesday, a majority of Spain's regional governments, who are in charge of healthcare, voted in favour of imposing restrictions in areas with more than 100,000 residents if they met three benchmarks - 500 cases per 100,000 inhabitants, 35% Covid patient occupancy in intensive care units and positive results in 10% of tests.
Madrid, which has a rate of 780 infections per 100,000, already meets the criteria. The order, published on Thursday, gives the city's authorities 48 hours to put in place the restrictions, which fall far short of the lockdown measures imposed nationally on 14 March.
Under the new restrictions, people in Madrid and nine neighbouring towns will only be allowed to leave their area for essential trips involving work, school and university, visits to the doctor and care for the vulnerable.
Social gatherings will be limited to six people and restrictions on hours and numbers are also being imposed on hotels, places of worship and shops. Parks and playgrounds are exempt unless the local authority chooses to shut them.
Madrid's regional government, which is controlled by the conservative opposition and did not vote in favour of the restrictions, has argued that the lockdown is not legally valid.
Regional health chief Enrique Ruiz Escudero accused the central government of sending a "message of alarm and agitation" and did not rule out fighting the lockdown in court. But Madrid president Isabel Díaz Ayuso said on Thursday that while the order would be challenged in court, it would be complied with.
The Madrid regional government had chosen not to put the city and surrounding areas into lockdown, instead issuing restrictions in 45 basic healthcare areas in a bid to curb the spread of the virus.
These measures themselves were controversial as they affected mostly poorer areas of the city and prompted protests by hundreds of residents.
Spain's central government argued that the restrictions were not sufficient and recommended an end to all unnecessary movement across the city.
Spain has seen a significant rise in cases in recent weeks. More than 31,411 people have died during the pandemic and there have been more than 748,000 infections, according to data from Johns Hopkins University.
The World Health Organisation earlier this week said European countries were seeing "worrying increases of the disease".