The competition went to a jump-off after six riders went clear across two rounds of the final, with Skelton the first to make it through on his trusty steed Big Star.
And Skelton and the brilliant Big Star produced a perfect technical round when it mattered, posting a clear round first up in the jump-off to ultimately seal Britain's 23rd gold medal of the Games.
The remarkable fall and rise of Britain’s golden rider Nick Skelton
Sweden’s Peder Fredricson was the only other rider to produce a flawless round in the jump-off, but he completed the course in a slower time than the British veteran to take silver.
Canada’s Eric Lamaze picked up bronze after picking up one penalty and finishing in a faster time than Switzerland’s Steve Guerdat in fourth.
"Brilliant," Skelton told the BBC. "You always dream about it but when it actually happens it is real life. I have been thinking about this and planning it since London four years ago.
"I never had a worry this morning, I've not had a worry all week and I really knew this horse would win it. I knew if I kept my cool this horse would do it and he did. I knew if I did not make a mistake, he wouldn't either."
A challenging Round B course produced a number of thrilling rides to set up the jump-off, with disappointment for pre-competition favourite Jeroen Dubbeldam - the Dutch flag bearer and a former World and Olympic champion - who only missed out on the finale thanks to a marginal time penalty.
Six riders made it through unscathed after two rounds, with the experienced Skelton jumping in his favoured position (first up) to put all of the pressure on the remaining five riders to try and beat his fast time at the same time as dealing with their horses' growing fatigue over the fences.
And Skelton was one of only two riders to go around without a mistake, taking the gold with the fastest time to cap off a remarkable career in spectacular fashion.
France comes from behind to win jumping gold
Horse Excellence: Smolders triumphs in Longines Global Champions Tour - Rome