The eighth seed roared through the first two sets and overcame the distraction of a back injury to Nadal, and then the loss of the third set, to take it 6-3, 6-2, 3-6, 6-3 in two hours 21 minutes.
Nadal, who was chasing his 14th major title, looked as if might pull out with the back injury but he fought back to take the third set and force the match into a fourth set.
Wawrinka began nervelessly and after holding his opening two service games for the loss of only two points he made the first move in the final, breaking Nadal in the fourth game.
The Spaniard played a poor drop-shot which was followed by a double-fault to open the door for Wawrinka.
More From This Section
The Swiss again had a break point in Nadal's next service game as he held his own serves without undue pressure.
Fresh from his psychological breakthrough, Wawrinka broke Nadal to love in the opening game of the second with with a cracking backhand return winner.
The Swiss was in the zone, reeling off 12 consecutive points against the non-plussed Nadal, who received a time violation warning for slow play between points.
Nadal's problems mounted when he grabbed his back after playing a forehand. He called for the trainer at the next changeover and went off the court for a medical timeout at 2-1 in the second set.