The match took 4 hours 49 minutes and ended just after 2 a.m. Wednesday morning.

Thiem unleashed 74 winners and even won more total points than Nadal, 171-166. But on match point, the only one in nearly five hours, Thiem hit an overhead long.

Nadal will play third-seeded Juan Martin del Potro in the semifinals on Friday.

Nadal and Thiem head to a fifth set

At about 12:50 a.m., Dominic Thiem sent his quarterfinal match against Rafael Nadal by winning the fourth-set tiebreaker. As in the third set, Thiem went up a break and then lost it. But Thiem took a 3-0 lead in the tiebreaker, helped by some sloppiness from Nadal, and held on to take the set.

This is the 11th meeting between Thiem and Nadal, but their first on a surface other than clay. Unlike many players in the younger generation, Thiem, 25, has had success against Nadal, winning three of their previous matches. But none of those victories came in a best-of-five-set match.

Nadal roars back in third set

Dominic Thiem broke Rafael Nadal at 3-3 in the third set with a blistering backhand return winner, and then served for the set three games later at 5-4. But Nadal broke him, then won the set himself, 7-5, by breaking Thiem again in a marathon 14-point game.