It was his country's first medal of the Games and came in the final event of the athletics programme.
Twice world gold medallist Abel Kirui was second ahead of compatriot and London marathon champion Wilson Kipsang.
Kipsang made an early break, splitting the field and passing through the halfway stage in 63 minutes 15 seconds. He was gradually reeled in and joined by Kiprotich and Kirui by the 30-km point in a three-man race for the gold.
The race, past some of London's most notable landmarks, started and finished in the Mall near Buckingham Palace. It comprised one short and three longer circuits through the heart of the capital.
"I was unknown, now I am known," Kiprotich said after winning Uganda's first medal of the Games in the final event of the athletics programme before thousands of cheering spectators on the streets of London.
John Akii-Bua, who set a world record in the 1972 Munich Games 400 metres hurdles final, was Uganda's only other Olympic champion.
"I always kept him in mind," Kiprotich said after accelerating away from Kenyans Wilson Kipsang and Abel Kirui with six kilometres remaining in the 42.195km race past some of London's most celebrated landmarks on a hot and humid morning.
"I saw him coming like a cheetah," exclaimed twice world champion Kirui, who had been locked in a three-way battle with Kiprotich and London champion Kipsang since the 30-km mark on a loop course with one short and three long laps. It was very hard to control that kind of move."
"I took it out because the pace was so slow and I knew we would have problems at the end so I tried to push," he explained.
Kiprotich crossed the line in two hours eight minutes one second, 26 seconds ahead of Kirui. Kipsang was 1:10 further back.
His time, in his fourth marathon, was the third fastest at the Olympic Games and his gold medal was the first of any kind by a Ugandan distance runner.
Kiprotich, 23, trains in Eldoret with a number of elite Kenyans, including Emmanuel Mutai, the east Africans' third man in Sunday's race.
"The problem with Uganda is that there are no facilities," he said. "I come from an area where there are no facilities.
"I spend some time in Kenya, some in Uganda but most of my time is spent in Kenya in a training camp.
"At the start of the race I thought either Kenya would win, Ethiopia would win. Then I thought maybe I could move.
"It is our second gold medal. I made history for my people, my coaches, my manager, for Uganda. I am happy."
- Related links