Image copyright Reuters Image caption Joseph Schooling enjoys the taste of gold

It isn't every day you come face to face with your childhood idol - and defeat him at the Olympics.

Singapore's Joseph Schooling defeated decorated US Olympian Michael Phelps in the 100m butterfly swimming race and won his country's first-ever Olympic gold medal.

The 21-year-old Singaporean won in an Olympic record time of 50.39 seconds.

Phelps came in second, earning a silver on 51.14 seconds - tied with South Africa's Chad Le Clos and Hungary's Laszlo Cseh.

"I'm just ecstatic. I need it to sink in," Schooling told reporters after his historic swim.

"It feels great - kind of feels surreal right now, it's crazy," he said.

"I really can't describe how this moment feels. All the adrenaline is running through my veins right now. It's a dream come true."

'Our flying fish'

Celebration and praise has poured in from his countrymen back home, who flooded social media early on Saturday morning with congratulations for their man in Rio.

"We are elated, so proud," said Singaporean Li Hsing, a mother-of-one at a local swimming pool.

"I was just sitting here watching my daughter swim and my phone kept going off with messages, for us Singaporeans - this is our first gold."

Image copyright Facebook: Channel NewsAsia

Image copyright Reuters Image caption Schooling and Phelps pose with their medals

Others like 18-year-old student Gerald Gan said Schooling would go down in modern Singapore history as being its first Olympic champion.

"To my friends and me, Schooling has always been the name to watch and support because he is a Singaporean, born and bred here," he told the BBC.

"We just celebrated Singapore's 51st birthday and this Olympic win was such a perfect present for our country.

"Onward Singapore, Joseph Schooling has brought pride to our home."

Singapore's Prime Minister Lee Hsien Loong also took to Facebook to congratulate the new Olympian.

"This is Singapore's first Olympic gold medal ever and also our first medal for ‪the Rio Olympics," he wrote in a post that gathered tens of thousands of likes and comments.

"My heartiest congratulations to Joseph Isaac Schooling for his historic gold medal win. It is an incredible feat to compete among the world's best - stay focused and emerge victorious.

"You made us very proud today."

Image copyright AFP Image caption Schooling and Phelps swam next to each other, neck-to-neck, during the butterfly heats

But to many Singaporeans following Schooling's Olympic journey, it was all about the emotions of seeing him meet his childhood idol back in the Olympic swimming pool - eight years after they first met.

Many on Facebook shared memes and photos of the swimmers' meeting in 2008.

"[This must have been playing out] in Joseph's mind: Doesn't matter if I win or lose, it was an honour to compete in Olympic swimming besides my childhood idol," said Koyuki Everdeen.

"I can really see that he put in a lot of hardwork and effort. And that's why he won first place."

Keith Power said: "Just shows the influence sports stars can have on impressionable young minds. He was obviously inspired - well done Joseph!"

Oli To thinks it must have been "a dream come true" for the Singapore swimmer.

"To swim and compete with Michael Phelps, Joseph is a winner and world-class whether he wins an Olympic medal or not."

"Their difference in timing was only a fraction of a second."