Phelps set the tone right from the start Thursday to become the first male swimmer to win the same individual event at three straight Olympics, capturing the 200-meter individual medley for his 20th career medal - and 16th gold. He touched in 1 minute, 54.27 seconds, just off his winning time in Beijing but still good enough for gold.
Lochte settled for silver and Hungary's Laszlo Cseh took the bronze.
So a farewell games that started as a bit of a disappointment for Phelps is definitely looking up. He's now won two golds and two silvers in five races - not up to his China standards, but a fitting capper to a brilliant career that still has two more events to go.
In fact, as soon as Phelps finished off Lochte, he hopped out of the pool and headed to the nearby diving well to warm down, knowing he still had a semifinal of the 100 butterfly before the night was done.
Lochte had gone through the same routine just a few minutes earlier, trying to pull off an impressive double 31 minutes apart. He came up short in both races, fading to bronze in the 200 backstroke behind fellow American Tyler Clary, then touching after Phelps in the medley.
Phelps' reaction wasn't a water-pounding celebration, just a dazed smile and a definite look of relief. He seemed to be soaking it all in, relishing a gold of his own in London with his previous victory coming in the 4x200 freestyle relay.
Lochte shook hands with his rival before crawling out of the pool for the last time at these games. In a symbolic gesture, he tossed his cap and goggles into the crowd, his work done. His final tally: two golds, two silvers, one bronze and a fourth-place finish - impressive, but undoubtedly shy of what he had predicted would be "my time."
This time still belongs the Phelps.
Rebecca Soni isn't doing too badly, either.
Tearing through the water in her favorite pink suit, Soni set her second world record in as many days to defend her Olympic title in the 200 breaststroke. She finished in 2:19.59, breaking her own mark of 2:20.00 set in the semifinals.
Soni broke into a big smile when she saw the time, racing the clock more than she was anyone in the water. Japan's Satomi Suzuki took silver, more than a second behind at 2:20.72, while Russia's Yulia Efimova claimed bronze in 2:20.92.
"I'm so happy," Soni said. "I can't believe I did it."
South Africa's Suzaan van Biljon led at the first turn, but the American quickly seized control on the second lap. She was comfortably ahead by the second turn, then turned on the speed for the record.
"It's been my goal since I was a little kid to go under 2:20," Soni said. "That's when my coach told me you're going to be the first woman to go under 2:19. I've been chasing it ever since. I'm just so happy."
While Lochte couldn't hold in the backstroke, it was still quite a night for the Americans. Clary rallied on the final lap to pull off the upset in an Olympic-record 1:53.41. Japan's Ryosuke Irie also got by Lochte on the final stroke, taking silver in 1:53.78. Lochte's time was 1:53.94.
"You always have big dreams in your head that you think you might be able to pull off something like that," Clary said. "The fact that it just came to fruition is something that hasn't even processed in my mind yet. The fact that I'm now an Olympic champion and Olympic-record holder is something that is very humbling. It's also very motivating for the next four years."
Last year, Lochte looked as though he had surpassed Phelps at the top of the swimming world when he captured five gold medals at the world championships. The Floridian didn't come close to that total at the Olympics, failing to defend his Olympic title in the 200 back and coming up short of Phelps again in the 200 IM.
Lochte won his first race of the Olympics with a dominating performance in the 400 IM on the opening night of swimming, but that was his biggest highlight. He failed to hold on in the anchor leg of the 4x100 freestyle relay, leaving the Americans with a silver, and he finished off the podium in the 200 free.
He did pick up a relay gold in the 4x200 free.