But the 28-year-old's 52.13-second finish time in the 100m butterfly was not enough to edge out 29-year-old Lochte, who finished first with a time of 51.93 seconds.

"I'm my hardest critic, so I know what I can do there," Phelps said after the race, Yahoo Sports reported. "But, like I've been saying this whole time, I’m having fun. I really do mean that. There's nothing like being able to come here, swimming in front of packed stands."

Phelps, who is the most decorated Olympian of all time, retired after the London Games, but announced last year he would resume training and re-enter the drug testing pool.