A spokesman for the Foreign Ministry, Lu Kang, said those actions contradicted the agreements that emerged from Mr. Xi’s meetings with Mr. Trump at Mar-a-Lago in April, among them the decision to lift the beef ban, which had been in place since December 2003. If not reversed, they could have consequences, he said.

“We hope the United States administration could correct its mistakes and bring China-U.S. relations back to the right track of healthy, stable and long-lasting development, so as not to affect bilateral cooperation in other important fields,” he said.

The arms sale to Taiwan, which Beijing considers part of its territory, was a violation of international law that “hurt China’s sovereignty and security,” Mr. Lu said, adding that China resolutely opposed it.

While administration officials said Mr. Trump had grown increasingly frustrated with China for not putting more pressure on North Korea over its nuclear and missile programs, the response showed that officials here, too, were frustrated by Mr. Trump’s lurching strategy and cavalier style of tweeting new policy.

The latest steps, analysts said, felt retaliatory, and thus could prove counterproductive.

“The United States has stabbed us in the back,” said Wang Dong, an assistant professor at the School of International Studies at Peking University. He said the sanctions — the first against a Chinese company for trading with North Korea since 2006 — would undermine China’s willingness to help resolve the nuclear issue.