Michael Phelps delivered one more history-making Olympic performance Thursday, winning the 200m medley to become the first man to win the same individual swimming event at three straight Games.
Phelps, already denied trebles in London in the 400m medley and 200m butterfly, delivered a vintage performance to win in 1min 54.27sec and collect his 20th career Olympic medal -- and his 16th gold.
He subdued his great rival -- team-mate Ryan Lochte -- who settled for silver in 1:54.90.
Hungarian Laszlo Cseh earned bronze in 1:56.22.
Although it was his first individual gold of the 2012 Games, there was no fist-pumping celebration from Phelps but instead a smile of quiet satisfaction as his mother and sister cheered from the stands.
On the podium, he accepted his medal with another smile, then heaved a huge sigh as the crowd roared.
In London, the 27-year-old American has been far from the dominant figure who captured an unprecedented eight gold medals in Beijing.
But his fourth and final Olympics has seen him further cement his legacy by seizing the record for most medals in a career and, now, becoming the first man to complete a golden swimming treble.
Australian icon Dawn Fraser and Hungarian Krisztina Egerszegi both accomplished the feat in women's events.
The 200m medley was among the six gold medals he won in Athens in 2004, and he gave himself a chance at another treble as he returned to post the fastest time in the 100m butterfly heats.
The medley defeat for Lochte was a bitter blow in an event in which he is the world record-holder and world champion. It came quickly on the heels of his bronze medal performance in the 200m backstroke, in which he was the defending Olympic champion.
American Tyler Clary, swimming in his first Olympics after failing to make the team in 2008, ran Lochte down in the last 25m to seize gold in an Olympic record of 1:53.41.
Japan's Ryosuke Irie also steamed past Lochte to take the silver in 1:53.78, 16-hundredths of a second in front of Lochte's 1:53.94.
"The fact I am now the Olympic champion and Olympic record holder is something that is very humbling," said Clary, who has toiled for years in the shadow of Phelps and Lochte.
"I stuck to my guns, kept my stroke on and was able to come by those last two on the last 15 metres and get my hand on the wall," he said.
"That was a perfect race I swam tonight," said Clary, who was already looking forward to Rio in four years' time.
American Rebecca Soni provided a suitable curtain-raiser to the drama of the Phelps-Lochte duel as she became the first woman to break 2min20sec in the women's 200m breaststroke.
Soni's victory in a world record of 2min 19.59sec made her the first Beijing swimming gold medallist to retain her title and improved on the world record of 2:20.00 she set in the semi-finals on Wednesday night.
Japan's Satomi Suzuki took silver in 2:20.72 and Russian Yuliya Efimova captured bronze in 2:20.92.
Ranomi Kromowidjojo of the Netherlands lived up to her favorite's billing in winning the women's 100m freestyle in an Olympic record of 53.00sec.
Aliaksandra Herasimenia of Belarus took silver in 53.38 and China's Tang Yi claimed bronze in 53.44.