The northern coastal city of Tianjin began testing its population of around 14 million on Sunday after at least two local cases of the highly-transmissible Omicron variant were detected, state media reported.
Residents in four districts would be tested over the next 24 hours while other districts would be tested the next day, the Tianjin government said.
Residents will only get the green health code necessary to travel once they receive a negative result, it said.
The city advised residents not to leave town for unnecessary reasons, the government said late on Saturday.
The Tianjin outbreak poses risks to Beijing and the upcoming Winter Olympics, because of the large number of commuters working and living in the two cities, the state-owned Global Times said, citing an unnamed immunologist.
It comes after the local transmission of the imported Omicron variant was found in the southern city of Guangzhou, according to a national health official in December, though the number of cases was not disclosed.
China reported 165 confirmed coronavirus cases for Jan. 8, up from 159 a day earlier, its health authority said on Sunday.
Of the new infections, 92 were locally transmitted, according to a statement by the National Health Commission, from 95 a day earlier.
Most of the new local cases were in Henan and Shaanxi provinces.
China reported 46 new asymptomatic cases, which it classifies separately from confirmed cases, compared with 52 a day earlier.
There were no new fatalities, leaving the death toll at 4,636. Mainland China had 103,619 confirmed cases as of Jan 8.