SHANGHAI — China vented on Thursday after President Trump signed new human rights legislation covering the protest-wracked city of Hong Kong. It denounced the new law as illegal interference in its own affairs. It summoned the American ambassador for the second time in a week. It vowed retaliation.

The threats sounded severe. They also sounded empty.

Behind the harsh rhetoric, China has few options for striking back at the United States in a meaningful way. And it has bigger priorities — namely, ending the increasingly punishing trade war between the two countries. Though both sides are talking about their willingness to reach a deal, they have yet to sign even an interim pact that would head off potentially damaging new tariffs less than three weeks from now.

On Thursday, Beijing’s main agency on trade remained quiet on the legislation even as other officials railed against it, suggesting that the government remained open to a trade deal and would let the volatile issue of Hong Kong simmer, at least for now.

“Beijing will make a lot of noises but they can’t afford to do much,” said Steve Tsang, director of the SOAS China Institute in London, a research center. “The trade deal is so important to the Chinese that they won’t let anything upset it.”