China will return an underwater U.S. drone seized by a naval vessel this week in the South China Sea, both countries said on Saturday, but Beijing complained that Washington had been "hyping up" the incident.

The drone, known as an unmanned underwater vehicle (UUV), was taken on Thursday, the first seizure of its kind in recent memory. The Pentagon went public with its complaint after the action and said on Saturday it had secured a deal to get the drone back.

"Through direct engagement with Chinese authorities, we have secured an understanding that the Chinese will return the UUV to the United States," Pentagon spokesman Peter Cook said in a statement.

The incident drew criticism from U.S. President-elect Donald Trump, who has vowed to take a more aggressive approach in dealing with Beijing.

The drone, which the Pentagon said was operating lawfully and was clearly marked as U.S. property, was collecting data about the salinity, temperature and clarity of the water about 50 nautical miles northwest of Subic Bay, off the Philippines.

It was seized on Thursday just as the USNS Bowditch was about to retrieve it, U.S. officials said.

The Defense Ministry said a Chinese naval vessel discovered a piece of "unidentified equipment," and checked it to prevent any navigational safety issues before discovering it was a U.S. drone.

"China decided to return it to the U.S. side in an appropriate manner, and China and the U.S. have all along been in communication about it," the ministry said on its website.

"During this process, the U.S. side's unilateral and open hyping up is inappropriate, and is not beneficial to the smooth resolution of this issue. We express regret at this," it added.

Trump, a Republican who takes office on Jan. 20, waded into the dispute on Twitter on Saturday.

"China steals United States Navy research drone in international waters — rips it out of water and takes it to China in unprecedented act," Trump said in a tweet early on Saturday from his seaside resort club Mar-a-Lago in Palm Beach, Florida, where he plans to spend the holidays.

Donald Trump tweet