The longest match of the US Open so far saw top seed Nadal comprehensively beaten in the opening set, before showing all his immense reserves of fight and spirit to knock out the ninth seed.
Nadal will face third seed Juan Martin Del Potro in the first of the semi-finals at Flushing Meadows.
"It's been a great battle," an exhausted Nadal said.
The conditions were tough, very humid for me. I'm very sorry for Dominic. He's a close friend on tour, a great guy and I wish him the very best ... He is young and has plenty of time to win tournaments.
Twenty-four hours after Roger Federer fell to John Millman, his old rival avoided following him out of the tournament, but only just. Ninth seed Thiem became the first player since Andy Roddick in 2004 to win a love set against Nadal in New York but the defending champion once again dug deep to come out on top of a gruelling battle played in more punishing humidity.
Remarkably, Thiem was the first top-20 player Nadal has faced at Flushing Meadows since his final win over Novak Djokovic in 2013, with last year's title seeing him take on a succession of unexpected opponents. And Thiem, the only man to beat Nadal on clay for the last two seasons, set about showing his opponent he meant serious business in his first Grand Glam quarter-final outside of the French Open. The Austrian blasted 13 winners, made only two unforced errors and allowed Nadal just seven points in winning an extraordinary opening set.
It was only the fourth time in his long Grand Slam history that Nadal had lost a set 6-0 and just the third time at any level in nearly seven years. But the last time, against Philipp Kohlschreiber in Miami last spring, he fought back to win the match. Nadal's ability to look only forward and forget what went before is one of his most important strengths and he set about turning around the match, closing in on the baseline, forcing Thiem to play one more ball and, eventually, to go for too much.
Rafael Nadal tröstet Dominic Thiem
Image credit: Getty Images
The Spaniard secured the break he wanted for 5-3 only to give it back but a sloppy game from Thiem, who turned 25 on Monday, handed him the set anyway. The momentum was with Nadal but Thiem regrouped in the third set and began to again blast winners into the corners. But, as in the second set, when the time came to keep his foot on Nadal's throat, he instead loosened the pressure and lived to regret it. Thiem was broken serving for the set and then could not hold on for the tie-break, saving two set points but not a third after planting a volley wide with the whole of the court available.
The fourth set was a wild 81-minute ride that began with Thiem facing break points, saw the Austrian threaten a double break before being pegged back and then a weary Nadal miss a chance to win the match. With Thiem serving at 5-6 30-30, a desperate lunging forehand looked to be easy pickings for Nadal at the net only for the 32-year-old to net it. Thiem held on for the tie-break, where another unexpected Nadal error, this time a short forehand into the net, sent the match into a deciding set.
With the clock ticking towards 1am and transport options dwindling, many fans headed for the exits while the two adversaries battled on. Having looked the more weary of the two, it was Nadal who was applying the greater pressure and at 5-5, 0-40 it seemed this was his chance. But Thiem saved all three break points before denying Nadal a fourth opportunity with a stunning volley at the end of a remarkable point.
That they were still able to produce tennis of such quality was astonishing. There was no let-up in the tie-break and, after four hours and 49 minutes, it was Nadal who claimed victory when Thiem sent a smash long. The Austrian hung his head before being consoled by Nadal, who then held his arms aloft in celebration and relief.
"It's going to be stuck in my mind forever," Thiem said.
I'm going to remember this match, for sure. It's cruel sometimes tennis, because I think this match didn't really deserve a loser. But there has to be one. If we skip the first set, it was a really open match from beginning to the end. The way it ended up in the fifth set tiebreaker, from there it's 50-50. He made one more point than me.