Hans-Kristian Vittinghus led the Danes to victory in the fifth and final match of the tie on the back of strong singles performances from fourth-ranked Viktor Axelsen and world number five Jan O. Jorgensen.
Denmark is the first European nation to win the Thomas Cup.
“Ever since we came here, since last week, I've been dreaming about being the deciding factor in a final,” said Vittinghus. “I really appreciate that my teammates put me in this position where I had a chance to win the cup for Denmark.”
In the opening match, European champ Axelsen kicked off the final by controlling the net as he exploited his height with smashing overheads and diving saves to take the first game.
World number eight Tommy Sugiarto grabbed the early lead in the second, but the Dane proved too strong, clinching the match 21-17, 21-18.
Following the win, Axelsen sprinted to the sidelines, tossing his shirt and racket into the roaring audience – a scene that would repeated by his teammates with each successive win.
“I was really nervous during the game, but I managed to stay calm in the end and that's why I won,” said Axelsen.
Second-ranked doubles team Mohammad Ahsan and Hendra Setiawan evened the score and halted Denmark's momentum with a 21-18, 21-13 over Mads Conrad-Petersen and Mads Pieler Kolding.
In the third match of the afternoon 19-year-old Anthony Ginting unleashed explosive energy to maintain Indonesia's momentum, but fifth-ranked Jorgensen remained measured and patient to deliver a 21-17, 21-12 victory executed with finesse.
But the Indonesians refused to go down quietly, battling for every shot as they pursued their 14th Thomas Cup title.
Doubles pair Angga Pratama and Ricky Karanda Suwardi clawed back initiative for their team, forcing the fifth match of the series after dispensing with Kim Astrup and Anders Skaarup Rasmussen 21-16, 21-14.
“At the beginning of the game we felt nervous because Denmark led 2-1,” said Suwardi. “Our strength is equal with Denmark so we never felt like underdogs.”
But the revival proved temporary. Vittinghus, who also staved off the team's imminent defeat in the semis, was in constant motion, firing repeated overheads and dropshots with growing certainty, as he overpowered Ihsan Maulana Mustofa 21-15, 21-7.
With their first Thomas Cup in hand, the Danes rushed the court and danced wildly as the Chinese fans stood up and cheered in approval.
“My confidence grew throughout the match. I was nervous in the beginning but I think I handled it pretty well,” said Vittinghus, adding that post-match celebrations will likely include “a lot beer, a lot of champagne and a lot of shouting and dancing”.
After China's untimely exit in the quarters, locals rallied around the Danes, favouring their relentless pace on the court and emotional displays in victory and defeat.
“I wasn't a Denmark fan when I came here, but I liked seeing them fight. I love the team's passion,” said newly minted Danish supporter Ji Fan after the win.
Thirteen-time Thomas Cup winners Indonesia were fighting to end their 14-year drought at the World Badminton Championship.