The 28-year-old Wawrinka had never taken a set off Nadal in 12 previous meetings, but attacked from the start against the 13-time major winner and regained his nerve after dropping the third set against the injured Spaniard.
Nadal appeared to be on the verge of retiring in the second set, when he hurt his back and needed a medical time out, but he refused to quit.
"It's really not the way you want to win a tennis match, but in a Grand Slam final I'll take it," said Wawrinka, the first man in 21 years to beat the No. 1 and No. 2 ranked players en route to a Grand Slam title.
Nadal was a hot favorite to win at Melbourne Park and become the first man to win each of the four Grand Slam tournaments twice in the Open era — instead, his injury curse struck again. It remains the only major he's hasn't won at least two times.
"Rafa, I'm really sorry for you, I hope your back is going to be fine, you're a really great guy, good friend and really amazing champion," Wawrinka said as he accepted his first major trophy. "Last year I had a crazy match, I lost it. I was crying a lot after the match. But in one year a lot happened — I still don't know if I'm dreaming or not but we'll see tomorrow morning."
Wawrinka lost in five sets to Novak Djokovic in the fourth round of the 2013 Australian Open, in the longest Grand Slam match of the season. Djokovic went on to win his third consecutive title at Melbourne Park, and then beat Wawrinka again in five sets in the U.S. Open semifinals.
But Wawrinka avenged those losses this time, beating Djokovic in five sets in the quarterfinals — ending a run of 14 straight losses to the Serbian player.
Now he'll move from No. 8 to No. 3. In doing so, he'll surpass Federer, a 17-time Grand Slam winner who lost to Nadal in the semifinals — to become the highest-ranked Swiss player for the first time in his career.
A constant supporter of his countryman, Federer was one of the first people to call and congratulate Wawrinka after his win.
Wawrinka also broke up a sequence of wins for the Big Four — with 34 of the previous 35 majors going to either Nadal, Djokovic, Roger Federer or Andy Murray.
"Stan, you really deserve it," Nadal said. "Luck was against me today but you really deserve it.
"Last thing that I wanted to do was retire. I hate to do that, especially in a final. Same time, is tough to see yourself during the whole year you are working for a moment like this, and arrives the moment and you feel that you are not able to play at your best."
Nadal has had a terrible stretch with injuries at the Australian Open, and has described it as his unluckiest Grand Slam. He won the title in 2009, and lost an epic five-set final to Djokovic in 2012. But he missed the 2013 edition during a seven-month layoff with knee injuries and illness, and his quarterfinal losses in 2010 and 2011 were affected by injuries.
"It has been a very emotional two weeks — I'm sorry to finish this way," he told the Rod Laver Arena crowd. "I tried very, very hard — this year was one of the more emotional tournaments in my career."
A possible retirement was looming when Nadal was serving at 0-2 in the second set. He bent over at the waist to stretch his back and then grabbed his lower back with his hand and grimaced in pain. His serve immediately dipped to 141 kph (87 mph).
When Nadal took a medical timeout after falling behind a set and a break, and returned to a chorus of boos without a shirt after 7 minutes, it seemed that an early finish was on the cards.
Wawrinka was aggravated during the time out, demanding that officials tell him why Nadal needed the break. And he came out aggressively to finish off the second set.
Nadal's serve speed dipped even further to 125 kph (77 mph) and then 114 kph (70 mph). The support in the stadium gradually shifted as the crowd saw the Spaniard battling to stay on the court.
His service speed improved in the beginning of the third set, prompting a fan to yell advice to Wawrinka: "C'mon Stan, no sympathy!"
By the end of the set, Nadal's serve was back up to 174 kph (108 mph) and Wawrinka's error count was escalating.
Wawrinka composed himself after an exchange of breaks in the fourth set to serve it out in 2 hours, 21 minutes. After a muted celebration, he consoled Nadal in the courtside chairs before getting a chance to hold up and kiss his first big trophy.