Chinese Foreign Ministry spokesman Geng Shuang said in a statement that the US warship's choice of route "severely undermines China's sovereignty and security."
The USS John S. McCain sailed within six nautical miles of Mischief Reef in the disputed Spratly Islands on Thursday as part of a "freedom of navigation operation," US officials told news agencies.
"China is strongly dissatisfied with this," Geng said, adding that the Chinese Navy had identified the American vessel, warned it to leave and then expelled it. He said Beijing considered the operation a violation of international law and would lodge an official protest with Washington.
China's claims to nearly all of the South China Sea are contested by a number of other countries in the region, including Brunei, Malaysia, the Philippines, Taiwan and Vietnam.
Read more: South China Sea - what you need to know
The United States has been critical of China's construction of islands and military facilities in the disputed waters, and its decision to pass within the 12 nautical miles that mark territorial limits internationally indicates that it does not recognize territorial claims there. The operation was the latest attempt by Washington to reassure it allies in the region, while at the same time challenging what it sees as an effort by Beijing to limit freedom of navigation in the strategic waters.
Around $5 trillion (4.25 trillion euros) in trade passes through the contested waterway each year.
Thursday's operation was the third of its kind since US President Donald Trump entered office in January. It came as his administration increases pressure on China to help rein in North Korea's nuclear program.
Row with North Korea
Tensions on the Korean Peninsula soared after Pyongyang carried out two intercontinental ballistic missile (ICBM) launches last month. In recent days, the US and North Korea have traded barbs, with North Korean military officials announcing they were readying plans to launch missiles towards the US island territory of Guam. Trump has responded by warning North Korea it would face "fire and fury" if it further threatened the United States.
China, North Korea's most important ally and trading partner, has reiterated calls for calm during the crisis. Beijing has long worried that any conflict on the Korean peninsula could lead to a wave of refugees crossing its northeastern border, or result in a reunified country allied with the United States.
nm/jm (AFP, AP, Reuters, dpa)