Ryan Lochte held off a fast-finishing Michael Phelps to win the 200 meters individual medley at the U.S. National Championships in Irvine, California on Sunday.
Trailing by almost a second and a half at one point, Phelps displayed his famous finishing kick and nearly made up the deficit in the final 50 meters to bring the crowd to its feet.
Lochte, the world record holder in the event, touched first in a time of 1:56.50, just ahead of Phelps in 1:56.55.
"We both hate to lose but we enjoy racing each other," Phelps told reporters. "Hopefully we can push each other and see what happens."
For Phelps, the result was a positive sign that his comeback from retirement is on the right track.
In the most significant meet since Phelps launched his comeback in May, the 18-times Olympic champion finished seventh in the 100m freestyle on Wednesday and second in the 100m butterfly on Friday.
The meet is also serving as a qualifier for the Pan Pac Championships in Australia later this month.
Phelps was slow out of the blocks and ceded control to Lochte, who was on world record pace over the first 50.
But Phelps turned on the afterburners down the stretch of his finishing freestyle, bringing back memories of previous dramatic wins during his storied career.
Five-time Olympic gold medalist Lochte earned his first medal of the meet.
The face of U.S. men's swimming after Phelps retired, Lochte has been working on a comeback of his own. He was competing in his second meet since tearing his MCL earlier in the year.
"This year has been up and down but I'm glad I got a win, it feels good," Lochte said.
"I haven't been in the water because of my knee, and haven't done the work I've wanted to. But there are two years left until (the Rio Olympics)."
Phelps, too, is building form for what is expected to be a return to Olympic competition in 2016.
The 29-year-old has shown flashes of his former self but had mixed results since returning to the sport earlier this year.
"Being able to get back in the water again, for me being able to finish with this, it's definitely better than where I was at the beginning of the meet," Phelps said.