Whitlock had to settle for silver in Doha last year but he edged a close competition with a score of 15.500, beating Lee Chih-kai of Chinese Taipei and Ireland's Rhys McClenaghan, who had pipped Whitlock to gold at both the Commonwealth Games and European Championships last year.
An early mistake might have cost Whitlock but the greater difficulty of his routine proved crucial.
Whitlock told BBC Sport: "I don't even know what to say, this time for some reason I'm speechless. I can't believe it. I feel so emotional, I'm so happy with that. This one meant so much for so many reasons."
Whitlock is the first British gymnast to win three world titles on the same piece of apparatus – he is also Olympic champion – while McClenaghan is the first Irish gymnast to claim a world medal.
There were tears also for Becky Downie, who thought at the age of 27 that her chance may well have gone.
Downie, who has bounced back from elbow and ankle injuries, produced a brilliant routine on the uneven bars to score 15.000.
For a long time it looked like that might be enough for gold, but she was eventually pipped by Belgium's Nina Derwael, who successfully defended her title with a score of 15.233.
She said: "It just means so much. It's taken so many years. I can't believe I've done it. It's a routine I've been working on for so long. I'm just super proud of the performance.
"I didn't know if this was going to be my last worlds so I've put my heart and soul into it."
Downie had earlier watched her younger sister Ellie take bronze on the vault behind American Simone Biles, who equalled Vitaly Scherbo's record by winning her 23rd world medal.
Ellie, 20, said: "I'm absolutely over the moon."
It was Biles' 17th gold, extending her own mark, but she was unable to set an outright overall record on Saturday as she could only finish fifth on the uneven bars.
She will have two more chances on Sunday, however, when the finals of her more favoured beam and floor events are held.