Uganda's Victor Kiplangat takes marathon gold at the World Athletics Championships
The 2022 Commonwealth Games gold medallist Kiplangat broke away on his own with about 4 km (2.5 miles) to go, crossing the finish line with an advantage of 19 seconds.
The race had appeared to be heading for a close finish, with Kiplangat and Ethiopia's Leul Gebresilase enjoying a sizeable lead as they entered the final 10km lap, but Gebresilase faded late and was left behind by the Ugandan.
"When I reached 30 km I knew I felt strong and decided to push. I had great energy and that allowed me to go. Then at 35 km I could surge again," Kiplangat said after his victory.
"That was always my plan and I managed to do it. The pace was high but I had more to give. It was tough but I always felt I had the power. I know the Ethiopian was close but I was sure it was my day."
An exhausted Gebresilase was then overtaken by Teferi, a silver medallist at last year's European Athletics Championships, in the last 200 metres. The Ethiopian, who clocked 2:09:19, ended with bronze.
Teferi, who fell over in the latter stages of the race before roaring back to claim silver, said: "I wanted to get the best out of me and this competition was my biggest target. I am glad I managed to fulfil my dream.
"I fell down after the 30 km and tore my t-shirt. Somebody touched me and I just fell but I tried to move on to finish the race in the best possible condition."
Defending champion Tamirat Tola, who was part of a three-man breakaway with Kiplangat and Gebresilase before fading, did not finish the race and dropped out after 39 km.
"I was trying my best. I was feeling good until 30 km. But after that, I started to have a bad feeling in my stomach," Tola said.
On a balmy day in Budapest, the mercury kept rising steadily after the 7 a.m. start.
The early pace was perhaps more brisk than the athletes would have preferred in the conditions, as the chasing pack attempted to keep within touching distance of early leader Ser-Od Bat-Ochir of Mongolia.
Bat-Ochir built up a lead of 35 seconds as he forged ahead on his own, but the pace proved unsustainable and he was reeled in just before the 10-km mark.
A pack of about 30 runners then slowed the pace and took control of it, before Kiplangat, Gebresilase and Tola made their move with 10 km to go.
The women's marathon took place on Saturday, with Ethiopia's Amane Beriso claiming gold.