A flyby of a Chinese-held shoal in the South China Sea by U.S. B-52 bombers sparked harsh words from Beijing on Wednesday, the latest sign in escalating tensions between the two military powers.

The near-pass of the Scarborough Shoal by the bombers, which China took from the Philippines in 2012, came days after U.S. Defense Secretary Jim Mattis accused Beijing of "intimidation and coercion" in the South China Sea.

China Foreign Ministry spokeswoman Hua Chunying warned the U.S. on Wednesday against "hyping up militarization and stirring up trouble" at a daily briefing in Beijing, according to the Associated Press.

The U.S. "doing whatever they want is risky and China will not be threatened by any military warships," Hua said, adding that China would take all necessary measures to defend its sovereignty.

Last month, China announced it had dispatched warships to drive away two U.S. Navy vessels sailing close to islands claimed by China in the Paracel Island chain after it had landed strategic bombers on an airstrip for the first time.

That naval confrontation came shortly after the Pentagon withdrew its invitation for China to participate in multinational naval exercises near Hawaii to protest China's military moves in the South China Sea. The initial move to place the weapons on the island, first reported by Fox News, angered U.S. officials who immediately disinvited China from the Rim of the Pacific Exercises.

US WARSHIPS SAIL NEAR DISPUTED ISLANDS IN SOUTH CHINA SEA, OFFICIALS SAY

Another naval conformation may be ahead on the horizon, as the U.S. is considering sending a warship through the Taiwan Strait, Reuters reported Tuesday.

A possible U.S. warship passage could be seen in Taiwan as a fresh sign of support by President Trump after a series of Chinese military drills around the self-ruled island that China claims as part of its territory.

CHINA REMOVES MISSILE LAUNCHERS FROM DISPUTED ISLAND AFTER ROW WITH US, IMAGES SHOW

U.S. officials told the Reuters news agency that the United States had already examined plans for an aircraft carrier passage once this year but ultimately did not pursue them, perhaps because of concerns about upsetting China.

The last time a U.S. aircraft carrier transited the Taiwan Strait was in 2007, according to Reuters.

China claims almost the entirety of the South China Sea, which includes some of the world's busiest shipping lanes, despite overlapping claims from neighbors including the Philippines, Vietnam and Taiwan.

Despite rising tensions, Mattis is expected to visit Beijing at an unannounced date. China's Defense Ministry has said it would welcome Mattis and hoped for continued exchanges with the U.S. military.

The Associated Press contributed to this report.