His legs were tired, but Britain's Mo Farah produced blistering pace in the final straight to become the first man in 40 years to retain the two Olympic distance titles.
The 33-year-old, who fought back from a stumble to claim the 10,000m last week, said his victory in the 5,000m on Saturday night had been the most satisfying of the four golds.
Farah won his second straight 5,000m in 13min 3.30sec to match the feat of Finland's Lasse Viren who retained the same Olympic titles in 1976.
"Oh my God I can't believe it," said Farah. "It's every athlete's dream but I can't believe it.
"My legs were tired after the 10,000m and people had to bring me food in my room.
"This is the most satisfying win of the four, it is incredible."
Farah, who trains in Oregon under ex-marathon great Alberto Salazar, said watching Ethiopian distance legend Kenenisa Bekele medalling had been an inspiration.
"When Bekele won all those medals I said I just want one.
"If you have dreams they can come true and I always wanted to achieve these for my kids because for so much of the year you don't see them and thus you want to show them something or rather the reason for the absences."
Kenyan-born American Paul Chelimo took silver in a personal best of 13:03.90. He was initially disqualified but quickly reinstated.
Ethiopian Hagos Gebrehiwet claimed bronze in 13:04.35.
The Ethiopians alternated the lead, with Kenyan-born Bahraini Albert Rop also in the mix.
With five laps to run, Farah was well positioned in second and then took over the lead, immediately dropping the pace so the pack bunched back up.
Farah led the 15-strong field through the 4km mark in 10:39.4 as the pace again picked up for the final kilometre under pressure from Ugandan Joshua Cheptegei.
Farah went through the bell head-to-head with Gebrewihet, who punched down the back straight.
Wow! Just Wow! Rio is Mo Town. @Mo_Farah is surely the greatest long-distance runner of all time. The double double.
— Gary Lineker (@GaryLineker) August 21, 2016
But Farah held firm and surged again from 200m. Chelimo looked like he might have had the beating of the Somali-born Briton as they entered the home stretch. But Farah found an extra step in his stride, timing 52.83sec for the final lap for a famous win.
"When I hit the front I wasn't going to let them past me," said Farah. "I wasn't going to let the inside lane go. I didn't want to get boxed in.
"There was pushing but that is part and parcel of the race. I hate to lose, I have been like that ever since I was a kid, I'm really driven. That's just me."
The victory sealed a distance double for Farah last achieved when Viren triumphed in the 1972 and 1976 Games in Munich and Montreal.
In a stellar career, Farah has already achieved the world double-double at the 2015 and 2013 championships in Beijing and Moscow.