Michael Phelps ended his incredible Olympic career, winning his 18th gold medal for the United States in the men's medley relay, the last time he will swim a competitive race.
Swimming the butterfly leg, the most decorated Olympian of all time went out as the ultimate winner when he joined forces with backstroker Matt Grevers, breaststroker Brendan Hansen and freestyler Nathan Adrian to win the gold.
The four set a combined time of three minutes, 29.35 seconds, just outside the world record set by the Americans in 2009.
Japan finished second after leading at the halfway stage while Australia stormed home to collect the bronze but no country was ever going to stand in the way of an American team determined to give Phelps the send off he deserved.
The 27-year-old was swimming his last race before retiring after breaking every imaginable record during his career and providing a last memory of his determination to win.
The US were ahead after the opening backstroke leg but slipped back to second following the breaststroke.
Then Phelps dived in for the last time and by the time he got back to handover to Adrian, the Americans were back in front and the result was a foregone conclusion.
In London, Phelps won four gold and two silver medals to finish his career with a total of 22 medals, four more than Soviet gymnast Larisa Latynina, who held the previous record for almost half a century before Phelps set a new mark that could last even longer.
Phelps already had the record for the most gold medals. By picking up his 18th, he finished his career with twice as many as the next best, the nine jointly held by Latynina, American athlete Carl Lewis, American swimmer Mark Spitz and Finnish distance runner Paavo Nurmi.