Rafael Nadal has advanced to the semifinals in his quest to repeat at the US Open, but just barely.

The top-seeded Nadal beat Dominic Thiem in their quarterfinal meeting on Tuesday night, narrowly avoiding a stunning upset at the hands of the Austrian in what was a thrilling match. Ultimately, Nadal was able to finish off Thiem in the early hours of Wednesday morning, punching his ticket to the final four. 

The dramatic back-and-forth match went the distance, with the reigning champ coming away victorious after five sets, including tiebreakers in the fourth and fifth sets as he won 0-6, 6-4, 7-5, 6-7 (4-7), 7-6 (7-5). 

The grueling match lasted four hours and 49 minutes -- Nadal's longest match ever at the US Open -- but his hopes of a second consecutive title stay alive. 

Nadal will move on to face No. 3 seed Juan Martin del Potro, who took down American John Isner earlier Tuesday. After dropping the first set to Isner, del Potro rallied to win three straight and won 6-7, 6-3, 7-6, 6-2. The early match was played in sweltering heat and punishing humidity, with temperatures reaching 95 degrees. 

On the women's side, Serena Williams will be one of the final four women standing. Williams punched her ticket to the semifinal with a win over No. 8 seed Karolína Pliskova at Arthur Ashe Stadium on Tuesday.

Williams took down her Czech opponent in two sets, winning 6-4, 6-3 in their quarterfinal meeting -- Williams' first win against a Top-10 ranked opponent in 2018. The 36-year-old Williams got off to a slow start in the match, but quickly turned things around to win eight games in a row and close out Pliskova in dominant fashion.

Serena will move on to face Anastasija Sevastova, who dominated defending US Open champ Sloane Stephens on Tuesday with a 6-2, 6-3 rout in the quarterfinals. The third-seeded Stephens was the highest remaining women's player in the Open with the top two seeds, Simona Halep and Caroline Wozniacki, going down early.

Sevastova, the No. 19 seed, played an unbelievable match to leave Williams and Madison Keys as the only two American women remaining. 

Sevastova took five break points to Stephens' two, as Stephens simply seemed unable to find her footing throughout the match. Sevastova served up only two aces, but she took advantage of a horrible day for Stephens' second serve. Stephens went just 1 of 9 on her second serves, canceling out an outstanding 81 percent first serve percentage.

All in all, it's a decent finish for Stephens, who had her ups and downs this season. After a first-round Australian Open exit, Stephens made the French Open finals where she lost to Simona Halep. At Wimbledon, she lost in the first round again, so a quarterfinal appearance in the US Open -- though it wasn't the goal -- is a decent note on which to end such a tumultuous Grand Slam season.

In her last two matches, Sevastova has defeated Stephens and No. 7 Elina Svitolina. Her 18 winners against Stephens' 13 were ultimately the difference in the match, as both players finished with 28 unforced errors.

The win was ultimately a grudge match for Sevastova, who lost to Stephens in last year's US Open quarterfinals. This is her first US Open semifinal appearance after making it to quarters the past two years. Sevastova actually retired from tennis for the 2013 and 2014 seasons, so she's coming back in a big way.