Lam, speaking at a news conference, said a ban on face masks would take effect on Saturday under the emergency laws that allow authorities to "make any regulations whatsoever" in whatever they deem to be in the public interest.
China's Hong Kong and Macao Affairs Office praised the move in a statement that said the protests were evolving into a "color revolution," a term coined to refer to popular uprisings in Ukraine and other former Soviet states that swept away long-standing rulers, with interference from external forces.
"Hong Kong has reached a critical moment to stop the chaotic situation with more effective measures," it said. "The current chaotic situation in Hong Kong cannot continue indefinitely."
The emergency laws allow curfews, censorship of the media, control of harbors, ports and transport, although Lam did not specify any particular action that might follow beyond the mask ban.
But it was far from clear if the introduction of emergency powers would deter the protesters.
Crowds took to the streets even before the decision was announced, swelling as night fell. Banks and shops in the busy Central district closed early in anticipation of violence as some protesters burned Chinese flags and chanted "You burn with us," and "Hong Kongers, revolt."
Thousands of demonstrators gathered in other parts of the territory, filling shopping malls and blocking roads as protests looked set to continue into the night. Bus routes were suspended and rail operator MTR closed stations.
"The anti-mask law has become a tool of tyranny," said Samuel Yeung, an 18-year-old university student, as crowds swelled in Central.
"They can make use of the emergency law to enact any policies or laws that the government wants. There's no rule of law anymore. We can only be united and protest."
Many protesters wear masks to hide their identity due to fears employers could face pressure to take action against them.
"Almost all protesters wear masks, with the intention of hiding their identity. That's why they have become more unbridled," said Lam.
"We can't keep the existing regulations idle and let violence escalate and the situation continue to deteriorate."
Lam described the territory as being in serious danger, but not in a state of emergency.
Pro-Beijing groups had been pushing for a mask ban but it was not clear how the government would implement it in a city where many of its 7.4 million residents wear them every day to protect against infection following the outbreak of the deadly Severe Acute Respiratory Syndrome (SARS) in 2003.
Police can stop anyone in public and ask them to remove a mask if the officer believes it may prevent identification, according to the law. Exceptions are made if the person wearing a mask can prove they need it for medical, religious or professional reasons.
Offenders face a maximum fine of HK$25,000 ($3,200) and imprisonment for a year, according to details of the prohibition published by the government.
Four months of anti-government protests have plunged Hong Kong into its biggest political crisis since its handover from Britain to Beijing in 1997 under a "one country, two systems" formula granting it autonomy.
What began as opposition to a proposed extradition law, that could have seen people sent for trial in mainland courts, has grown into a broad pro-democracy movement and a serious challenge to Chinese leader Xi Jinping.
Authorities had already loosened guidelines on the use of force by police, according to documents seen by Reuters, but the emergency powers could backfire, some analysts fear.
"This is the next significant miscalculation," said Phill Hynes, head of political risk and analysis at ISS Risk, shortly before the widely expected introduction of the emergency laws.
"The next will be barring certain candidates from running in District Council elections. Both will nicely inflame tensions and increase protests and actions."
Pro-democracy campaigners condemned Lam's decision.
"This is an ancient, colonial set of regulations, and you don't use them unless you can't legislate anymore," said Martin Lee, a veteran activist and one of the city's most prominent lawyers. "Once you start, there's no end to it."
The UN human rights office said Hong Kong must protect the right to freedom of assembly and Britain urged its former colony not to aggravate tension.
Some Hong Kong's businesses, struggling with a dip in tourism and retail sales due to the protests, gave the law a warmer welcome.
"I agree with it at this point," said businessman Allan Zeman, who is also an economic adviser to Lam. "You have to do something drastic to end the violence. A lot of people will think twice about coming out."
But Hong Kong shares fell on Friday, hitting one-month lows.
Violence escalated on Tuesday, the 70th anniversary of the founding of the People's Republic of China, when police fired about 1,800 volleys of tear gas, 900 rubber bullets and six live bullets - one of which hit an 18-year-old.
The student, Tony Tsang, was shot at close range as he fought an officer with what appeared to be a white pole. He has been charged with rioting, which carries a maximum 10-year sentence, and assaulting an officer. Tsang is in stable condition in hospital.
The shooting enraged the protesters who rampaged across the city, throwing petrol bombs, blocking roads and starting fires as police responded with tear gas.
The protesters are angry about what they see as creeping interference by Beijing in their city's affairs.
China dismisses accusations it is meddling and has accused foreign governments, including the United States and Britain, of stirring up anti-China sentiment.
(By Clare Jim and Noah Sin; Additional reporting by Twinnie Siu, Donny Kwok, James Pomfret, Jessie Pang, Felix Tam and Farah Master in Hong Kong, Sun Yilei in Shanghai and Chen Aizhu in Singapore; Writing by Anne Marie Roantree and Bill Rigby; Editing by Robert Birsel and Alex Richardson)
Every week, more than 2 million listeners tune into our broadcast and follow our digital coverage like this story, which is available to read for free thanks to charitable contributions from listeners like you. But less than 1% of our audience supports our program directly. From now through the end of the year, every gift will be matched dollar for dollar by a generous donor, which means your gift will help us unlock a $67,000 challenge match.
Will you join our growing list of loyal supporters and double your impact today?