Soon, Abdulaziz Hatem gave another jolt to the 4-time champions by adding a second in the 27th minute with a stunning long-range effort.
Qatar survived a scare at 2-0 when Takumi Minamino pulled one back on 69 minutes, only for Uzbek referee Ravshan Irmatov to award the Maroons a penalty on review for a handball by Japan captain Maya Yoshida.
Qatar had never before gone beyond the Asian Cup quarter-finals but they scored 16 unanswered goals coming into the final and kept a record six clean sheets. Japan, meanwhile, had never lost an Asian Cup final, winning the last of their record four titles in 2011.
But the Blue Samurai were soon chopped down to size by Ali's outrageous opener, taking him past Iran legend Ali Daei's record tally of eight goals at the 1996 tournament.
Cleverly found by Afif, Ali flicked the ball up to himself before launching into an overhead volley that left Japan goalkeeper Shuichi Gonda helpless as it flew in off the post.
Ali almost scored again within a minute, only to be denied by a desperate block from Yoshida.
However, Qatar doubled their lead in the 27th minute after yet another Afif assist—his 10th of the tournament—as Hatim bent in a sumptuous left-foot shot from distance.
Japan, whose only previous Asian Cup defeat by Qatar came 31 years ago, mustered little of note, much to the chagrin of their colourful fans among a crowd of 36,000—several sporting fancy dress, including one hardy soul in an inflatable sumo suit.
That all changed when Minamino breached Qatar's defence for the first time this tournament with a delicate chip after Hatim had blazed over from close range.
But moments later Afif ended Japan's resistance from the spot to complete a fairytale triumph for Qatar.