After winning eight gold medals in Beijing, London was always going to be a lap of honor for the American who said he would retire after the Games, but it proved to be a coronation worthy of a king.
Phelps was not as dominant as he was four years ago but through adversity he provided an everlasting reminder of why he is the greatest swimmer of all time.
After a slow start to the meet where he was beaten in his first two individual events, he finished strongly, winning gold medals in his last four events, setting records that may never be beaten.
Michael Phelps of the US celebrates with his trophy awarded to him by FINA honouring him as the most decorated Olympian of all time, after winning the men's 4x100m medley relay final during the London 2012 Olympic Games at the Aquatics Center, Aug 4, 2012.
He won six medals in London, four golds and two silvers, more than any other athlete in any sport at the Games. When he won his third, he passed Soviet gymnast Larisa Latynina's long-standing record of 18 career medals.
When he completed his final race, Phelps signed off with 22 medals, including 18 golds. No-one else, in any sport, has won more than nine.
"I always said nothing is impossible if you believe in yourself and work hard," he said.
"I couldn't ask to finish on a better note. I have done everything I wanted to do. I am very happy."
While he won more medals than anyone else and his farewell added a nostalgic touch to the London Games, Phelps was not alone in the spotlight.
US teenager Missy Franklin emerged as the new face of swimming by also winning four golds in her first Olympic appearance.
The 17-year-old broke the 200 meters backstroke world record and joined forces with her American team mates to break the medley relay world record.
Unfazed by the attention and magnitude of the Games, she gushed and giggled her way through an exhausting program to draw comparisons with Phelps.
No woman has won more than eight career gold medals in swimming and with half as many from her first appearance, Franklin has already raised the possibility she could end up as the greatest female swimmer of all time.
"I don't think his shoes will ever be filled. I think his footsteps are just huge," she said. "But hopefully I can kind of make little paths right next to his."
(Clockwise from top left) Michael Phelps, Ye Shiwen, Missy Franklin and Sun Yang.
While Phelps and Missy topped the gold medals count with four each, including two each in relays, only three other swimmers won two individual golds.
Ranomi Kromowidjojo of the Netherlands won the women's 50 and 100 freestyle finals to complete the sprint double while Sun Yang and Ye Shiwen both won twice for China.
Sun became the first swimmer in 32 years to complete the 400-1500 double, smashing his world record in the gruelling 30-lap event, while 16-year-old Ye won the women's medley double, breaking the world record in the 200m with a sizzling final lap that triggered accusations of foul play.
"My results come from hard work and training and I would never use any banned drugs," she told reporters in London. "The Chinese people have clean hands."
China won five gold medals in swimming but could not match the strength and depth of the Americans who won 16 of the 34 medals on offer, 32 in the pool and two in open water.
France won four golds while the Netherlands, South Africa and Hungary won two each. Australia, one of the sport's traditional giants, won just one gold to be level with Tunisia and Lithuania, who won their first gold in swimming when 15-year-old Ruta Meilutyte won the 100 breaststroke in one of the biggest surprises in the pool.