The classic rivalry between teammates Michael Phelps and Ryan Lochte peaked Thursday with a final showdown in the 200m IM.

Receive the latest sports updates in your inbox

Michael Phelps signals his three-time Olympic win in the 200-meter individual medley over rival teammate Ryan Lochte. Phelps is the first swimmer to win gold in the same event in three consecutive Olympic games.

Updated at 2:05 PM EST on Friday, Aug 3, 2012

Michael Phelps made history in his final showdown with Ryan Lochte, becoming the first swimmer to win gold in the same event in three straight Olympics in the 200m individual medley on Thursday.

For Phelps, who plans to retire after his last Olympic race on Saturday, the triumph over Lochte proved he remained the top swimmer in the world, probably the best ever.

Golden Athletes of the London 2012 Games

While Phelps is not the swimmer he was in 2008, when he won eight gold medals in Beijing, he has spent this year's games securing his place in Olympic record books. His 20 career medals -- 16 golds, two silvers and two bronzes -- make him the most decorated Olympian of all time. And now he owns the three-peat mark as well.

Phelps, amazingly, has a chance to complete another three-peat on Friday, in the 100m butterfly.

“In the middle lane it's me and Michael. I look over at Phelps and we have a little stare-off, look who wants it more. We step on the blocks and take your marks, boom. I take off. I'm hitting the water like a rocket and I'm not looking back.”

Lochte, not one for modesty, said his imaginary clash ends with him dusting Phelps in the home stretch, breaking the world record in the process. “I get up on the lane lines and I unleash, my muscles are flexing and bulging, I'm like, yeah!”

Reality was not as glorious. But still, Lochte had a good day on Thursday.

Lochte took on Phelps less than 30 minutes after racing in the 200m backstroke, in which he came in third to teammate Tyler Clary, whose 1:53:41 finish was an Olympic record, and silver medal winner Ryosuke Irie of Japan. With that bronze, and the silver in the 200m IM, Lochte finished his work at the Londong games with two golds, two silvers and one bronze. That brought his career Olympic medal count to 11.

Phelps swam the 200m IM in 1:54:27, six tenths of a second ahead of Lochte. Laszio Cseh of Hungary finished third.

Also on Thursday, American Rebecca Soni broke a world record for the second time in two days, winning gold in the 200m breaststroke. Her unprecedented performance, which unfolded in 2:19:59, gave Soni a second gold in that event. She won it in Beijing in 2008.