Japan is the fourth nation, after Indonesia, China and Malaysia, to lift the Thomas Cup.
Malaysia gave a tough fight in the first doubles and won the second, but lost the deciding singles. The decider saw Boon Heong Tan and Thein How Hoon save a match point to make it 19-20.
In the second doubles, 13th ranked Keigo Sonoda and Takeshi Kamura brought Japan closer to the title but they were eventually beaten after losing control in second and third games.
Ueda defeated Liew in a tough battle. Ueda was first cruising when he led 15-9 after winning the first game. But Liew fought back to clinch the game. However, the deciding game turned Ueda's way.
The results (final): Thomas Cup: Japan beat Malaysia 3-2 (Kenichi Tago lost to Lee Chong Wei 12-21, 6-21; Kenichi Hayakawa & Hiroyuki Endo beat Boon Heong Tan & Thien How Hoon 12-21, 21-17, 21-19; Kento Momota beat Wei Feng Chong 21-15, 21-17; Keigo Sonoda and Takeshi Kamura lost to V. Shem Goh and Wee Kiong Tan 21-19, 17-21, 12-21; Takuma Ueda beat Daren Liew 21-12, 18-21, 21-18).