HONG KONG — China’s Ministry of Foreign Affairs on Tuesday criticized a Pentagon report that explicitly accused China’s military of staging attacks on the computer systems of the American government and military contractors.

“China has repeatedly said that we resolutely oppose all forms of hacker attacks,” said a ministry spokeswoman, Hua Chunying. “We’re willing to carry out an even-tempered and constructive dialogue with the U.S. on the issue of Internet security. But we are firmly opposed to any groundless accusations and speculations, since they will only damage the cooperation efforts and atmosphere between the two sides to strengthen dialogue and cooperation.”

In its annual report to Congress on Chinese military capabilities, which was released on Monday, the Pentagon said that last year, “numerous computer systems around the world, including those owned by the U.S. government, continued to be targeted for intrusions, some of which appear to be attributable directly to the Chinese government and military.”

In a telephone interview, a retired People’s Liberation Army major general, Xu Guangyu, who is now a senior consultant at the China Arms Control and Disarmament Association in Beijing, voiced sentiments similar to that of Ms. Hua. He said that China was the victim, not perpetrator, of Internet hacking.