(CNN) -- Back in the pool for the first time since 2012, Michael Phelps was close to his peerless best.
The most decorated Olympian of all time raced to a second-place finish in the 100m butterfly final in front of a sell-out crowd at the Skyline Aquatic Center, Arizona.
Phelps came up two-tenths of a second short of an instant return to winning ways with a time of 51.93 seconds -- coming in just behind his longtime rival and friend Ryan Lochte.
Phelps time ranks as the fourth fastest this year, and -- although two seconds slower than his own 49.82 world record -- the 28-year-old was satisfied.
"I said I wanted to be around 52.0 and I would be completely happy with that," Phelps told ESPN, before reiterating that has future was still undecided.
"It's one meet; it's one race. It's a long way whether I decide to continue or not."
A 628-day wait
The 1,200 people in attendance might have been a few less than the 17,000 he entertained at his last race -- the gold medal-winning 4x100 medley relay at the London Olympics -- but the 18-time Olympic gold medalist told reporters he hadn't felt so nervous about a race since he was a 10-year-old.
Phelps retired after winning an unprecedented 22nd Olympic medal on 4 August 2012 and embarked on a year of travel and golfing with little mention of a return to swimming.
But Phelps sparked speculation about a potential comeback by re-entering the U.S. Anti-Doping Agency's testing program last November -- which began a nine-month wait required before a swimmer can again compete.
Taking to the pool in competition for the first time in 628 days, he had cruised through his qualifying heat with the fastest time of 52.84 seconds, just ahead of Lochte who went on to win the final in the second fastest time in the world this year.
"I probably wouldn't have gone that time if Phelps wasn't in that pool with me. We push each other all the time," said Lochte.
"Down there at the turn I kind of peeked over and I saw him and almost started smiling," Lochte said, at which point, Phelps interjected: "Why? Because you were ahead?"
Phelps is still non-committal on his swimming future, and declared himself happy to have shed his post-retirement weight gain, and post a strong time.
"This was awesome. I'm really excited about how things went. I do know what I need to do if I want to continue and swim faster."
He will also race in today's 50m freestyle in Arizona but, beyond that, he has not yet committed to the U.S. national championships in August or next year's world championships in Kazan, Russia.
Inevitably the question of a return to Olympic action arose -- with a potential fifth games in Brazil now just over two years away. But Phelps says he is taking "one step at a time."
For now, the screaming crowd and Lochte's delighted welcome mark a tentative beginning to the legend's comeback.
"With what he's done for the sport of swimming and him leaving kind of broke my heart a little because I love getting on those blocks and racing him," said Lochte. "Now that he's back I've got a big ol' smile on my face."
And for Phelps, too, the enjoyment is just starting: "You're going to hear this word come out of my mouth a lot," he told reporters, "but I was having fun."