The order bans about 10,000 people living inside multiple housing blocks within the neighbourhood of Jordan from leaving their apartments until all those in the area had been tested.
Officials said they planned to screen everyone inside the designated zone within 48 hours "in order to achieve the goal of zero cases in the district".
"Residents will have to stay at their premises to avoid cross-infection until they get their test results," health minister Sophia Chan told reporters on Saturday.
The government had deployed over 3,000 staff to enforce the lockdown, which covers about 150 housing blocks.
Residents were seen lining up for testing at more than 50 mobile specimen collection vehicles parked in the area and for basic daily supplies provided by the government.
By lunchtime on Saturday, around 3,000 people in the area had been tested.
Hong Kong was one of the first places to be struck by the coronavirus after it spilled out of central China.
It has recorded just over 10,000 infections with some 170 deaths by imposing effective but economically punishing social distancing measures for much of the last year.
Over the last two months the city has been hit by a fourth wave of infections, with authorities struggling to bring the daily numbers down.
Stubborn clusters have emerged in low-income neighbourhoods notorious for some of the world's most cramped housing.
The district of Jordan recorded 162 confirmed cases from the beginning of this year to January 20.
On Saturday, the city recorded 81 infections, of which 21 were from Yau Tsim Mong area where the restricted district is located.
-- Inequality and housing shortages --
On paper Hong Kong is one of the richest cities in the world.
But it suffers from pervasive inequality, an acute housing shortage and eye-watering rents that successive governments have failed to solve.
The average flat in Hong Kong is about 500 square feet (46 square metres).
But many squeeze themselves into even smaller subdivided flats -- cubicles that can be as tiny as 50 square feet or even less, with shared bathrooms and showers inside ageing walk-up buildings.
It is in these kinds of buildings where clusters have been located in recent weeks, prompting the first lockdown order.
In recent days health officials began carrying out mandatory testing in about 70 buildings in the area, but the government has now decided to test everyone so as to "break the transmission chain".
The lockdown has created considerable confusion for residents.
The looming restrictions were leaked to the city's local media on Friday but there was no official statement from the government until Saturday morning once the lockdown had come in overnight.
Some media reported seeing residents leave the area ahead of the midnight deadline while others said locals were frustrated by the lack of clear information.
Authorities said people who were not in the restricted area at the time but had stayed in it for more than two hours in the past 14 days must undergo compulsory testing before midnight today.
The area is also home to many ethnic minorities, mainly South Asian Hong Kongers, a community that often faces discrimination and poverty.
Earlier in the week a senior health official sparked anger when he suggested ethnic minority residents might be spreading the virus more readily because "they like to share food, smoke, drink alcohol and chat together".
Critics countered that poverty and a lack of affordable housing forcing people to live in cramped conditions were to blame for the virus spreading more easily in those districts -- not race or culture.
The health official's remarks also came as a video of predominantly white migrants dancing at a packed brunch on the more affluent Hong Kong Island sparked anger but no admonition from officials.