The Pentagon says it has "secured an understanding" with China that it will return an underwater drone seized in the South China Sea.
China captured the US vessel in international waters on Thursday. It has not explained why and accused the US of "hyping-up" the incident.
US President-elect Donald Trump accused the Chinese of "stealing".
"We should tell China that we don't want the drone they stole back - let them keep it!" he tweeted.
The incident is among the most serious military confrontations between the two powers for decades.
The Pentagon said the drone, known as an unmanned underwater vehicle (UUV), was being used to carry out scientific research at the time it was captured and demanded its immediate return. It warned China not to repeat such a move in the future.
But a spokesman said later on Saturday that an agreement had been reached.
"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 Chinese defence ministry said the vessel would be returned in an "appropriate manner". It is not clear when this might happen.
It criticised the earlier US response, calling it "inappropriate and unhelpful".
Mr Trump had already inflamed the Chinese by speaking on the phone earlier this month with the leader of Taiwan, breaking a long-standing US practice on the China-Taiwan dispute.
For the earlier tweet, accusing the Chinese of stealing, he drew criticism online for misspelling the word unprecedented - the latest in a series of errors in his Twitter posts. He has now corrected the entry.
A Chinese Navy ship seized the unmanned drone 92km (57 miles) north-west of Subic Bay near the Philippines in the South China Sea on Thursday.
The craft was retrieved and examined to maintain the safety of passing vessels, China's defence ministry said in a statement.
The US said the unmanned drone was being operated by civilian contractors and was about to be retrieved by USNS Bowditch, an oceanographic research ship.
It made a formal diplomatic complaint to China over the incident.
Senator Ben Cardin, the top Democrat on the Senate Foreign Relations committee, called the seizure "a remarkably brazen violation of international law", while Senior Republican Senator John McCain said the US should not tolerate "such outrageous conduct".
Observers said the seizure was the most significant military incident between the two countries since a 2001 mid-air collision between a US Navy surveillance aircraft and a Chinese fighter jet that led to the death of a Chinese pilot.
It will likely add to US concerns about the growing military build-up by China in the South China Sea.
China has claimed territorial rights over parts of the region but its claims are disputed. It is not clear if China claims the territory in which the drone was seized.
A US think tank reported this week that aerial imagery shows that China has installed weaponry along seven artificial islands they have built at sea, despite US protests.