Some residents of Shanghai were allowed out of their homes on Tuesday as the city of 25 million eased a two-week-old shutdown after videos posted online showed what was said to be people who ran out of food breaking into a supermarket and shouting appeals for help.

The number of people who were allowed out was not clear. The government said some markets and pharmacies also would reopen.

The abrupt closure of most businesses and orders to stay at home left people angry about a lack of access to food and medicine.

People who test positive for coronavirus have been forced into sprawling temporary quarantine facilities criticised by some as crowded and unsanitary.

Meanwhile, the US set up a possible new clash with Beijing by announcing all "non-emergency US government employees" would be withdrawn from its Shanghai consulate while consular officers would stay.

The Chinese government complained last week after the US said diplomats and their families could leave if they wanted to.

The unusual severity of Shanghai's shutdown, from March 28, appeared to be driven as much by politics as by public health concerns.

The struggle in China's richest city is an embarrassment during a politically sensitive year when president Xi Jinping is expected to try to break with tradition and award himself a third five-year term as leader of the ruling Communist Party.

China's case numbers are relatively low, but the ruling party is enforcing a "zero-tolerance" strategy that has suspended access to major cities to isolate every infected person.

Some officials were fired after being accused of failing to act aggressively enough.

The government reported 24,659 new cases on Monday, including 23,387 with no symptoms. That included 23,346 in Shanghai, only 998 of whom had symptoms.

In Shanghai, more than 200,000 cases but no deaths have been reported in the latest wave of infections.

The government eased restrictions by announcing residents of Shanghai neighbourhoods that have had no cases for at least two weeks would be allowed out of their homes starting on Tuesday.

It said they could go to any other area that also had no new cases during that time.

Shanghai has 7,565 such "prevention areas", according to city officials cited by state media. They gave no details of how many people were affected.

People in 2,460 "control areas" with no new cases in the past week were allowed out but cannot leave their neighbourhoods, the government said.

Residents are barred from leaving their homes in "quarantine areas" that have had infections in the past week.

The abrupt shutdown caught Shanghai by surprise and prompted complaints people were left without access to food or medicine and were unable to look after elderly relatives who lived alone.

The government distributed packages of vegetables and other food for a few days at least twice to some households. Others said they received nothing.

A video that circulated online Saturday showed what the caption said were people in the Songjiang district breaking into a supermarket and carrying away cartons of food.

Another showed people thrusting their fists into the air in front of what appeared to be government employees wearing hooded white protective suits.

A third showed what it said were people in flats, barred from going outside, shouting appeals for help out of their windows.

The ruling party requires Chinese social media operators to enforce censorship and remove videos and other postings about banned topics.

Social media and online bulletin boards are filled with complaints about the Shanghai shutdown and appeals for food or medicine. It is unclear how many others might have been deleted.

City officials apologised publicly and promised to improve food supplies. Despite that, residents said online grocers often sold out early in the day or were unable to deliver.