President Donald Trump on Wednesday signed into law congressional legislation backing protesters in Hong Kong, drawing a swift and furious response from Beijing, which promised 'firm countermeasures'.

The legislation, approved unanimously by the Senate - the United States' upper house, and by all but one member of the House of Representatives - the lower house, last week. This requires Hong Kong's special trade status with the US to be reviewed annually by the State Department, and also threatens sanctions for human rights violations.

Congress passed a second bill, which Trump also signed, banning export to the Hong Kong Police of crowd-control munitions, such as tear gas, pepper spray, rubber-coated bullets and stun guns.

"I signed these bills out of respect for President Xi, China, and the people of Hong Kong," Trump said in a statement.

"They are being enacted in the hope that Leaders and Representatives of China and Hong Kong will be able to amicably settle their differences leading to long term peace and prosperity for all."

A foreign ministry statement issued on Thursday, shortly after the US announcement, repeated heated condemnations of the law and promised "firm countermeasures". Hong Kong's government, which received a drubbing in district elections on Sunday, expressed "extreme regret".

Protesters have been on the streets of the territory since June, angered first by a proposed extradition bill that would have allowed people to be sent to China for trial. That bill has now been dropped, but the protests have evolved into wider calls for China to stand by commitments made to allow Hong Kong a "high degree of autonomy" when it regained sovereignty over the city in 1997.

That pledge, known as 'one country, two systems', was meant to last 50 years and is the basis of the self-governing Chinese territory's special status under US law. Protesters say freedoms have been steadily eroded.