The law also requires Hong Kong's police to establish a national security division, and states that it may hire "specialists and technicians from outside the Hong Kong Special Administrative Region" - meaning mainland China.
The Chinese official also slammed worldwide criticism over the controversial law for Hong Kong, saying other countries had no right to get involved.
"That is just completely contrary to the notions of law that we had in Hong Kong, which is law as an accessible, transparent process, where before you enact a law you discuss, you get the draft out, you debate it", said Wilson Leung, a commercial litigator and a council member of Hong Kong's bar association, which has criticized the national security law and demanded greater transparency in the drafting process.
The law covers anyone anywhere in the World even if they are not Hong Kong residents.
But legal experts say the national security law demonstrates how Beijing sees its own political diktat as now superseding Hong Kong's rule of law.
With riot police deploying a water cannon, cordons and pepper spray to keep marchers off the main local road between the shopping district of Causeway Bay and the center city, tens of thousands took to secondary streets. There must be many who are now scared of even visiting Hong Kong.
The central government in Beijing has an overarching responsibility for national security affairs in Hong Kong.
Police will use a new purple flag to warn protesters if they display banners or shout slogans that may constitute a crime under the law and could be arrested and prosecuted for violating it.
The July 1 anniversary has always been a polarising day in the semi-autonomous city.
But critics fear it will crush the freedoms that are seen as key to Hong Kong's success as a financial centre.
Democracy advocates have used the date to hold large protests as popular anger towards Beijing's rule swells. During last year's huge pro-democracy demonstrations, the city's legislature was besieged and trashed by protesters.
For the first time since the ceremony began 17 years ago, authorities have banned the annual July 1 democracy march. Hong Kong's mini-constitution, the Basic Law, and its decades of independent judicial rulings protecting civil rights were to take precedence over Beijing's governance until at least 2047.
Hong Kong leader will appoint judges for national security cases under law.
With 66 articles in six chapters, the law clearly defines the duties and government bodies of the HKSAR for safeguarding national security and four categories of offences - secession, subversion, terrorist activities, and collusion with a foreign country or external elements to endanger national security - and their corresponding penalties.
"The world witnessed the courage of Hong Kong's pro-democracy activists, who a year ago took to the streets to defend their autonomy from China's authoritarian grip", Rubio said in a statement.
China will have jurisdiction over "serious" cases and its security agencies will also be able to operate publicly in the city for the first time.
Twenty-seven countries - including Britain, France, Germany, Australia and Japan - issued a rare oral rebuke of China at the UN Human Rights Council in Geneva, describing "deep and growing concerns" over the new law.
Its last British governor, Lord Patten, said the move had breached agreements made with the United Kingdom before Hong Kong was handed over in 1997.
China's enactment of the national security law drew statements of deep concern and regret from overseas and a firm defence at home.
Meanwhile, pro-democracy lawmakers said the new law has certified the death of "one country, two systems".