Dozens of pro-Beijing gathered in front of the city's government headquarters to toast the law's passing while holding Hong Kong and Chinese flags.
"I am very happy," said a man who gave his surname as Lee.
Meanwhile, protesters in a glitzy shopping mall chanted pro-democracy slogans and told Reuters they deplored the decision by Chinese authorities to move forward with the legislation.
"Most of the Hong Kong people, indeed all of them, have no idea what even the law is, and no idea what the provisions are, and what are the punishments, and what are the so-called punishable acts," said a man in his twenties who declined to give his name.
China's parliament passed national security legislation for Hong Kong earlier in the morning, setting the stage for the most radical changes to the former British colony's way of life since it returned to Chinese rule 23 years ago.