1.1878606-3258447683
USA's Ryan Murphy, Cody Miller, Michael Phelps celebrate after victory in the 4x100m medley relay. Image Credit: AFP

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.

Phelps: The 23 golds

Athens 2004

1.     100m butterfly

2.     200m butterfly

3.     200m individual medley

4.     400m individual medley

5.     4x200m freestyle relay

6.     4x100m medley relay

Beijing 2008

1.     200m freestyle

2.     100m butterfly

3.     200m butterfly

4.     200m individual medley

5.     400m individual medley

6.     4x100m freestyle relay

7.     4x200m freestyle relay

8.     4x100m medley relay

London 2012

1.     100m butterfly

2.     200m individual medley

3.     4x200m freestyle relay

4.     4x100m individual medley

Rio 2016

1.     200m butterfly

2.     200m individual medley

3.     4x100m freestyle relay

4.     4x200m freestyle relay

5.     4x100m medley relay

Phelps: 5 career moments

1) It was swimming's race of the century: 19-year-old emerging star Phelps up against the great Ian Thorpe and compatriot Grant Hackett and defending Olympic champion Pieter van den Hoogenband in the 200m freestyle in Athens. Phelps set an American record but finished third. The defeat only fueled Phelps - who set a world record in a dominant 200m freestyle triumph four years later in Beijing.

2) Phelps' seventh gold medal in Beijing came by the narrowest of margins, in a scintillating duel with Milorad Cavic - the tough-talking Serbian who said he'd like to go down in history as "some guy" who spoiled Phelps's eight-gold bid. In the lone final in which he failed to set a world record, Phelps beat Cavic by one one-hundredth of a second. It wasn't Phelps' first close-run 100m fly gold. In Athens, he beat world record-holding teammate Ian Crocker by four one-hundredths of a second.

3) Phelps' 200m butterfly triumph in Beijing was a master-class in discipline and technique as Phelps swam most of it blind when water filled his goggles but still set a world record.

4) Just as he had in Athens and Beijing, Phelps had to rally in London to win a third straight 100m butterfly, coming off the turn in seventh and powering home to turn the tables on South African Chad le Clos - who had beaten him at the last stroke in the 200m fly. The victory gave Phelps his 17th Olympic gold.

5) Phelps wrested back the 200m butterfly crown in Rio - avenging his defeat to le Clos who faded to finish fifth and returning to the top in the event that started it all. The win made Phelps the oldest individual swimming gold medallist in Olympic history at 31. There to share it were fiancee Nicole Johnson and three-month-old son Boomer, whose kiss from his teary dad melted hearts at the Olympic Aquatics Stadium.