Mo Farah stole the show at the athletics show in the 10,000m on Saturday, the United States says it reached 1,000 gold medals overall, but the night belonged to an emotional Phelps.
The 31-year-old had to come from behind on the butterfly leg of the 4x100m medley but set up the victory in 3min 27.95sec which included a world record in the backstroke leg by America’s Ryan Murphy.
It was a fittingly triumphant swansong for Phelps, 31, the most decorated Olympian in history who added five golds and a silver in Rio. He finished his career with 28 medals overall.
Phelps said he had felt himself “starting to crack” heading for the pool. But the man who gave up once after the 2012 London Games said he had no regrets about returning to competition.
“This is how I wanted to finish my career. I’ve lived a dream come true. Being able to cap it off with these Games is just the perfect way to finish,” he said.
The women’s quartet of Kathleen Baker, Lilly King, Simone Manuel and Dana Vollmer also won their race, which the US Olympic Committee said took the country to 1,000 Olympic golds.
Usain Bolt is also looking for a perfect finish to his Olympic career, by sweeping the 100m, 200m and relay sprint golds for the third straight Olympics.
The Jamaican and his US arch-rival Justin Gatlin both came through their preliminary races with ease Saturday.
Barring a catastrophe, they will clash in the final at 0125 GMT (Monday) and both are confident.
“I’m feeling good. I’m happy,” said Bolt. “So now it’s all about execution and getting it right when it comes to the finals.”
On the track, Mo Farah had to pick himself up after being clipped by training partner Galen Rupp in the 10,000m.
He gave a thumbs up to Rupp, galloped away and produced a trademark surge on the last bend to win in 27min 05.17sec.
“When I went down, I thought, ‘Oh my God, that is it.’ I just got up and wanted to stick with the guys and stay strong,” Farah said. “It’s never easy but everyone knows what I can do.”
Elaine Thompson ended the reign of Shelly-Ann Fraser-Pryce with a women’s 100m victory of 10.71sec which torpedoed her fellow Jamaican’s hopes of an Olympic hat-trick in the event.
Tori Bowie of the United States took silver with 10.83sec while Fraser-Pryce claimed bronze in 10.86.
Twenty-one golds were on offer on ‘Super Saturday’ but there was no repeat for Britain’s golden girl Jessica Ennis-Hill, who was dramatically denied a second straight heptathlon win.
Belgium’s Nafissatou Thiam needed to finish the closing 800m, within nine seconds of Ennis-Hill, and made it when she crossed 7.47sec behind.
American Jeff Henderson won the long jump with a leap of 8.38m, and immediately dedicated the victory to his mother, who has Alzheimer’s disease.
“My mum can’t be here, she has Alzheimer’s. When I place that medal in her hands, I’ll be crying,” Henderson said.
Germany’s Christoph Harting won discus gold to keep the title in the family after his brother Robert, the 2012 champion, ruined his chances by straining his back while turning off a light with his foot.
At the velodrome, Britain’s Katie Archibald, Laura Trott, Elinor Barker and Joanna Rowsell-Shand smashed the women’s team pursuit world record for the second time in 48 hours to take gold, beating world champions USA to defend their title.
The Netherlands’ Elis Ligtlee pulled off a shock when she won the women’s keirin, beating Britain’s Becky James with Australian legend Anna Meares third.
Brazil and Argentina’s basketball captains appealed for calm among their rival fans before the visitors won a gripping contest 111-107 after double overtime.
But football star Neymar cheered the hosts as he curled in a free kick for his first goal of the competition in a 2-0 quarter-final victory over Colombia.
In tennis, Andy Murray shrugged off a code violation for directing the word “stupid” at the umpire to crush Japan’s Kei Nishikori 6-1, 6-4 and move to the men’s singles final.
Seeking to become the first player to win back-to-back Olympic singles titles, the world number two will face Juan Martin del Potro, who edged 2008 champion Rafael Nadal 5-7, 6-4, 7-6, (7/5).
Olympic rowing ended Saturday with Great Britain winning the men’s eight gold to top the medal table for the third successive Games.