Michael Phelps signed off his Olympic career in style with a gold medal in the 4x100m individual medley, his fifth gold in Rio and the 23rd of his illustrious career.
The USA claimed victory in an Olympic record time of 3:27.95, with Great Britain taking silver and Australia bronze.
Ryan Murphy put the Americans ahead on the backstroke leg, but a blistering swim by Great Britain's Adam Peaty meant that Phelps jumped into the pool for the last time in second position.
James Guy turned first for Team GB at the halfway mark of the butterfly, but Phelps had a long look at the Briton as they came up from the turn and put down the pedal as he powered through to fittingly touch for the final time in front.
Nathan Adrian made no mistake on the freestlye leg and ensured the 31-year-old Phelps finished with a gold in what was the final event of the swimming program in Rio.
“We put together great relays,” Phelps said after the race. “Murph starting off with a world record is just insane … I’ve had the opportunity to be on some of the greatest relays of all time. It truly is an honor.”