The Chinese Foreign Ministry on Saturday protested the sailing of a U.S. warship near a disputed shoal in the South China Sea, saying Beijing would take "necessary measures" to safeguard its sovereignty.

The missile destroyer came within 12 nautical miles of Scarborough Shoal, called Huangyan Island by China, on Wednesday night, according to Foreign Ministry spokesman Lu Kang.

Scarborough Shoal, a triangular atoll located some 220 kilometers west of the Philippine main island Luzon, was effectively seized by China in 2012. Manila continues to claim sovereignty over the feature.

The U.S. action is seen as being part of the Pentagon's "freedom of navigation" operation in the South China Sea being conducted in an apparent move to challenge Beijing's claims and activities in the disputed water.

China's navy warned the U.S. vessel to leave after conducting procedures to identify it, Lu said.

"We firmly oppose any country using navigation and overflight freedom as an excuse to hurt China's sovereignty and security interests," Lu said.

"We strongly urge the U.S. side to immediately correct its mistake and stop making such provocative moves so as to avoid undermining China-U.S. relations and regional peace and stability," he added.

U.S. freedom of navigation operations are meant to test Chinese claims and assert the U.S. position that the contested features lay in international waters.

Beijing claims virtually the entire South China Sea, a vital shipping route and a rich fishing ground with possibly large oil and natural gas deposits.

==Kyodo