The state media reported that officials in the city ordered residents to stay at home unless there was a compelling reason. They also suspended all transportation to and from the city, except for special cases.
The order was to be in effect at midnight, and it would last indefinitely.
Each household will allow one person to go out every two days to purchase household necessities, according the order.
Xi’an reported Wednesday 52 coronavirus cases locally transmitted in the past 24 hours.
China has implemented strict pandemic control measures as part of its zero-transmission programme. This includes frequent lockdowns and universal masking.
These measures were taken in advance of the Beijing Winter Olympic Games, which will begin on February 4.
The Xi’an restrictions were the most severe since China in 2020 imposed a strict lockdown of more than 11,000,000 people in and around Wuhan’s central city after COVID-19 was detected for the first time there in late 2019.
Social media posts showed panic buying of household and grocery products. The government said that new supplies would be available on Thursday.