The burly Swiss just about held his nerve and concentration despite a controversial injury timeout taken by the world No 1 when he trailed 3-1 in the fourth set.
Despite being stalled before his own serve Wawrinka held on to win 6-7, 6-4, 7-5, 6-3 in three hours and 55 minutes as justice prevailed.
It was a third Major title for the late blooming Swiss – worth £2.65 million – after the Australian and French Opens, putting him level with Andy Murray. Djokovic was denied a thirteenth.
For an emotional Wawrinka it was the eleventh straight time he has won when reaching a tournament final. He had no hard feelings about the timeout, saying of Djokovic: ‘You are a great champion and great person and it is because of you that I am who I am today.
‘This is amazing. I came here without expecting anything but every time I stepped on court I won. I’m completely empty. I had to bring everything I had and there was so much emotion. This is something I have never had before. My goal is to give everything I have and be the best I can be.’
Djokovic paid heavily for only taking three out of the seventeen break points he created, a highly uncharacteristic figure for someone renowned for their mental toughness.
‘Stan was the more courageous player in the decisive moments and he deserved to win this title,’ he admitted.
‘It was still a fantastic couple of weeks for me. I didn’t know if I was coming here. If someone had told me I was going to make the final I would have taken it.
‘At this level of professional sport after playing for seven or eight months you aren’t very fresh. We both felt it. He was the better player, he was tougher mentally and knew what to do. A few moments decided it.’
Djokovic, sometimes hobbling and sometimes not, was allowed treatment on his toes by the physio, but had looked completely worn down by the baseline assault of Wawrinka, considered only an outside bet for the title after a relatively unspectacular year.
A furious Wawrinka had needed to sit in his chair while the Serb’s toes were attended to in a supposed ‘acute medical’ situation. Patrick McEnroe, commentating on ESPN television, described it as ‘complete abuse of the rules.’
Medical timeouts, and the way players, including Djokovic, have been able to call for them at will, have been a running debate the whole fortnight.
Djokovic was much the less fresher and early in the fourth set had shown signs of cramp, although he had come in having played nearly nine hours less tennis in the fortnight due to the spate of withdrawals against him.
Britain’s Dan Evans could claim to have taken Wawrinka to the brink in the third round when he had a match point against him.
Uncertainties have surrounded the Serb here , from various niggling injuries to the turbulence in his private life that he referred to before the tournament began.
His wife Jelena was here supporting him, but sitting at the back of his player box, in a less prominent position than used to be the case. She looked notably disinterested throughout the first set, although did manage a bit of applause from when her husband got to 4-1 up in the tiebreak.
What was beyond dispute was the sharp start of Djokovic, who showed incredible defence to break for 2-0. With Wawrinka’s backhand especially hesitant he should have won the opener far easier than he did.
He was in complete control until serving for it at 5-3, when his level dropped dramatically and he was broken back on a double fault.
In the tiebreak his astonishing back court defence led to the point of the match at 2-0, and he then ripped a backhand pass for 3-1.
Wawrinka, wearing gaudy maroon, loosened up notably in the second set and started reeling off those huge backhands in a manner reminiscent of his sensational French Open performance against the same opponent last year.
With the Swiss going into full Stanimal mode, breaks were exchanged but then Wawrinka broke again to take the set when the Serb, gasping for air, sent a forehand long.
A missed volley gave Wawrinka the break for 2-0 at the start of the third, and while he was hitting glorious winners it was underpinned by the kind of defensive scrambling more associated with Djokovic or Andy Murray.
The increasingly anxious Serb was by now in a series of dialogues with his coaching team up in the box, another nod to Murray.
Djokovic arrested the run of losing five straight games to level up for 3-3, with Wawrinka having to employ all the variety on his serve just to keep that famous red nose in front.
Another tiebreak looked inevitable when Wawrinka sneaked up from behind at 6-5 to break serve as Djokovic’s nerve deserted him at deuce, missing two backhands in succession to gift the set. Wawrinka looked up at his coach Magnus Norman and tapped his temple.
In each set late on the Serb had wobbled on his serve, and the blow was compounded when the world number three broke again at the start of the fourth, with Djokovic’s right thigh muscle apparently starting to cramp after such an attritional tussle. There had been little sign that his toes were a problem.
Meanwhile, Angelique Kerber pledged that she will be able to handle the pressure of being world number one after beating Karolina Pliskova 6-3 4-6 6-3 to win the women’s final. ‘After Australia I felt it a lot but now I’m ready to have it on my shoulders,’ she said after an unlikely second Grand Slam title in 2016.