Rio de Janeiro - Michael Phelps brought down the curtain on his glittering Olympic career when he helped the USA win 4x100m medley relay gold at the Rio Games on Saturday, taking his personal tally to 23.
Phelps took the lead in the third leg, the butterfly, before Nathan Adrian brought it home as the United States won ahead of Britain and Australia.
Phelps and his teammates took the deck to a thunderous ovation and Ryan Murphy got the Americans off to a blazing start, clocking a world record 51.85sec on the opening backstroke leg.
But Adam Peaty, who twice broke the 100m breaststroke world record en route to gold in Rio, got past American Cody Miller on the second leg, pulling Great Britain from sixth to first.
That meant Phelps hit the water for the third butterfly leg with work to do, and the superstar, swimming his fifth and final Olympics, didn't disappoint.
He overhauled Britain's James Guy to send Adrian into the final freestyle leg with a lead he wouldn't relinquish.
The Americans won in an Olympic record of 3min 27.95sec with Great Britain's Chris Walker-Hebborn, Peaty, Guy and Duncan Scott second in 3:29.24. Australia's Mitch Larkin, Jake Packard, David Morgan and Kyle Chalmers took bronze in 3:29.93.
The victory continued America's stranglehold on an event they have never lost in Olympic competition.
And it gave Phelps his fifth gold of the Rio Games after his triumphs in the 4x100m free, 4x200m free, 200m butterfly and 200m individual medley, with a silver in the 100m fly for good measure.