The two flags were displayed at a ceremony in Victoria Harbour.
For the second year running, Hong Kong authorities had banned demonstrations marking the July 1, 1997 handover, citing COVID although critics believed political motives are involved.
Previous years have seen major protest marches against the policies of Beijing.
Streets in Hong Kong remained calm on Thursday, in contrast to last year, when thousands of demonstrators had ignored the ban.
Police warned against breaches and said 10,000 officers would be on standby.
China said the law was needed to counter threats, but it was also used to quash voices of dissent in the semi-autonomous territory that had previously enjoyed a degree of political autonomy.
According to Amnesty International, the law has brought Hong Kong “close to a police state and created a climate of fear that is felt in all parts of society,’’ in the words of the group’s Asia expert, Theresa Bergmann.
The authorities were accused of arbitrary detentions, harassment and censorship.
This year’s anniversary coincided with the Chinese Communist Party’s centenary, marked with a mass event at Beijing’s Tiananmen Square.
Under the terms of Hong Kong’s return to China, Beijing had agreed to govern it independently according to the principle of “one country, two systems.’’
The seven million Hong Kongers were promised a “high degree of autonomy’’ at the time, and assured that many political freedoms would remain for 50 years, until 2047.
Since the enactment of the security law, however, many only talked about “one country, one system.’’ (dpa/NAN)