China expressed anger on Tuesday after a U.S. Navy destroyer sailed near islands claimed by Beijing in the disputed South China Sea, saying it resolutely opposed an operation that it called a threat to its sovereignty.

Beijing and Washington are locked in a trade war in which they have imposed increasingly severe rounds of tariffs on each other's imports.

A U.S. official, speaking on condition of anonymity, said the destroyer the USS Decatur traveled within 12 nautical miles of Gaven and Johnson Reefs in the Spratly Islands on Sunday.

The operation was the latest attempt to counter what Washington sees as Beijing's efforts to limit freedom of navigation in the strategic waters, where Chinese, Japanese and some Southeast Asian navies operate.

China's Defense Ministry said a Chinese naval ship had been sent to warn the U.S. vessel to leave.

The ministry said China has irrefutable sovereignty over the South China Sea islands and the waters around them, and the situation there is progressing well thanks to the hard work of China and countries in Southeast Asia.

"The U.S. side repeatedly sends military ships without permission into seas close to South China Seas islands, seriously threatening China's sovereignty and security, seriously damaging Sino-U.S. military ties and seriously harming regional peace and stability," the ministry said.

"China's military is resolutely opposed to this," it said. The Chinese armed forces will continue to take all necessary steps to protect the country's sovereignty and security, the ministry said.

China's Foreign Ministry said in a separate statement it strongly urged the United States to stop such "provocative" actions and to "immediately correct its mistakes".

For its part, the U.S. Pacific Fleet said Tuesday that the Chinese destroyer came aggressively close to a U.S. Navy ship in the South China Sea, forcing it to maneuver to prevent a collision, describing an encounter that could worsen tensions between the nations.

The Chinese warship approached the USS Decatur in an "unsafe and unprofessional maneuver" on Sunday near Gaven Reefs in the South China Sea, said U.S. Pacific Fleet Spokesman Lt. Cmdr. Tim Gorman.

The Chinese destroyer "conducted a series of increasingly aggressive maneuvers accompanied by warnings for Decatur to depart the area," Gorman told the Associated Press in an emailed statement.

It approached within 45 yards (41 meters) of the Decatur's bow, forcing it to maneuver, Gorman said.

The operation also comes as military ties between the two countries have dived, with China also angered by U.S. sanctions on China's military for buying Russian arms and by U.S. support for self-ruled Taiwan, which Beijing claims as its own.

U.S. Defense Secretary Jim Mattis said on Monday he did not see relations between the United States and China worsening, a day after his trip to China was canceled.

Reuters reported on Sunday that China canceled a security meeting with Mattis that had been planned for October. A U.S. official, speaking on the condition of anonymity, said Mattis was no longer going to China.

China has not yet commented on the matter.

Chinese Defense Minister Wei Fenghe is due to visit the United States later this year but China's Defense Ministry suggested last week that may not happen.