BEIJING — German’s domestic intelligence agency has accused China of using LinkedIn and other social media sites to infiltrate the German government, a charge that the Chinese government promptly denied.

In a scathing investigation released on Sunday, the intelligence agency, the Office for the Protection of the Constitution, accused Beijing of using social media to target more than 10,000 citizens, including lawmakers and other government employees. To win their trust, the agency said, Chinese agents posed as leaders of think tanks and headhunters, and offered all-expenses-paid trips to China and meetings with influential clients.

In Beijing on Monday, Lu Kang, a spokesman for the Ministry of Foreign Affairs, called the investigation “complete hearsay and groundless.” He urged German officials to “speak and act more responsibly.”

The German investigation added to anxieties in Western countries about Chinese efforts to infiltrate foreign governments and businesses, in an attempt to gain a competitive advantage, especially on economic and foreign policy issues. The United States has accused China of rampant economic espionage. Australia is debating tougher laws to guard against foreign interference, amid reports that China is meddling in Australian universities and elections.