Phelps ended up in a three-way deadheat for silver with South Africa`s Chad le Clos and Laszlo Cseh of Hungary, 0.75s behind Schooling`s winning time of 50.39 seconds.
Three-quarters of a second later, Phelps touched the wall at the same moment as South Africa`s Chad le Clos and Hungary`s Laszlo Cseh, all three recording a time of 51.14 seconds.
`It is a wild way to end my individual career. It is just wild,` Phelps said after the race. I was like `Three? Three of us tied for third?`
The race had been billed as a clash between Phelps and le Clos.
But Schooling looked stunned and humbled as he claimed his tiny nation state`s first ever Olympic gold medal after racing Phelps, his childhood hero.
Schooling was born in Singapore, but went to school in Jacksonville, Florida before attending the University of Texas.
`It was just a thrill to swim against Michael Phelps and all those guys,` he said after the shock win. `I`m just ecstatic. I don`t think it has set in yet. It`s just crazy.`
Phelps hardly looked dejected as he claimed his silver, linking arms with le Clos as all three swimmers enjoyed rapturous applause.
The Greatest of All Time said he was happy to have finished his Olympic solo career by tying with two of his closest rivals.
`A three-way tie is pretty wild,` he said. `It`s faster than I went, I think, four years ago to win. Joe is tough.`
`He had a great year last year and has had a really great last two years so hats off to him. He swam a great race.`
Phelps added: `Well I saw second next to my name and then I looked up again and then I looked over at Laszlo and Chad like, huh, we all tied for second, that`s kind of cool.
`Chad and I have had some races over the last four years and Laszlo and I - I can`t even remember when our first race was.
`Probably as long as Ryan (Lochte) and I. So kind of special and a decent way to finish my last race. I can`t complain too much.`
Schooling, meanwhile, smiled and tried to take in the enormity of his win as the gold was placed around his neck and the unfamiliar national anthem of Singapore rang out.
The young swimmer clasped his chest, sang along and fought back tears before punching the air as he took a lap around the aquatic arena.
He still looked awestruck as Phelps congratulated him warmly, scarcely able to believe he had beaten the Team USA legend.
`I`m sorry if I don`t seem like I`m full of emotions but I don`t know what to believe - that I actually did it or I`m still preparing for my race. I`m between the two of them,` Schooling said.
The two swimmers even shared an embrace in the pool after the thrilling race, which had originally been billed as a clash between Phelps and South Africa`s Chad le Clos.
Schooling, 21, looked stunned and humbled as he claimed his tiny nation state`s first ever Olympic gold medal after racing Phelps, his childhood hero.
`I need to let this moment sink in, realize what I`ve done and then I`ll have a better understanding of what I accomplished.`
`But right now all I can say is I`m really honored and privileged to have an opportunity to race in an Olympic final alongside huge names like Michael Phelps, Chad Le Clos and Laszlo Cseh, guys that have redefined the sport.`
Phelps still has a chance to end his Olympic career on a golden note, as he will race in the Men`s 4x100 medley relay.
More about: