Michael Phelps wins 18th and final Olympic gold in London
American Michael Phelps won the 18th and final Olympic gold medal of his career with a win in the 4x100m medley relay, before heading into retirement.
The 27-year-old swam the third butterfly leg at London's Aquatics Centre to help the United States past Japan in three minutes 29.35 seconds.
Australia took the bronze, with Great Britain in fourth.
Phelps ends his career with 22 medals in total, 18 of them gold, from four Olympic Games.
"It's tough to put into words right now, but I finished my career how I wanted to," said an emotional Phelps. "Through the ups and downs of my career I've still been able to do everything that I've ever wanted to accomplish.
"I've been able to things that no-one else has ever been able to do and this is one of the funnest ways to finish it, in a relay."
Backstroker Matt Grevers and breaststroker Brendan Hansen set the US on their way in the last final of the London 2012 swimming competition, but it took Phelps to wrestle the advantage away from an impressive Japan team.
Nathan Adrian then brought the US home in the final freestyle leg.
Phelps made his Olympic debut in Sydney in 2000 as a 15-year-old and won six golds and two bronze medals in Athens, followed by an historic eight gold medals in Beijing.
After his final race the American was awarded with a trophy by swimming's world governing body, Fina, confirming Phelps's status as the 'greatest Olympic athlete of all time.'
The swimmer used the opportunity to thank his coach of 15-years Bob Bowman.
"Tonight was a very emotional for Bob and I," said Phelps.
"I wouldn't be here today without everything he's done for me and I love him to death, and thankful I have someone who cares so much for me and who has put up with me over the past 15 years, so he's been great and I literally can't thank him enough.
"I've been able to become the best swimmer of all time and I said we got here together and I thanked him."
Despite a slow start, when he finished fourth in the 400m individual medley and second in his favoured 200m butterfly event, Phelps ended London 2012 with more medals than any other swimmer at the Games - four golds and two silvers.