Rafael Nadal came through his first stern examination at the US Open to move a step closer to a maiden Flushing Meadows meeting with Roger Federer.
The Spanish second seed dropped a set for the first time in the tournament but still saw off 2014 champion Marin Cilic 6-3 3-6 6-1 6-2.
Nadal was clearly irritated when given a time violation as he served midway through the second set, and was broken moments later.
But the three-time champion quickly shrugged it off to march into the last eight, with a stunning around-the-net winner bringing up match point to the delight of an Arthur Ashe crowd which included Nadal's friend Tiger Woods.
“It’s an easy shot to describe, but difficult to make,” said Nadal. “I don’t know, I think I followed the ball good because he had a good volley and I saw it.
“I ran fast to the ball and I saw at the last moment there would maybe be a small space on that side.
“I think it was the only way to win that point. I hit it well, but to hit that spot you need some luck.”
It is a statistical quirk that Federer and Nadal, rivals across 15 years and 40 matches, have never met at the US Open.
But defending champion Novak Djokovic’s exit has opened up the possibility of a box-office final between the pair.
Federer faces Grigor Dimitrov, a player he has beaten seven times out of seven, in the last eight.
Nadal will take on Diego Schwartzman after sixth seed Alexander Zverev ran out of steam in his bid to reach the quarter-finals for the first time.
Meanwhile women's top seed and defending champion Naomi Osaka crashed out of the tournament in the fourth round after a straight-sets defeat by Belinda Bencic.
Osaka has been carrying a knee injury and called the trainer and a medic on midway through the second set, although she was able to carry on without receiving any treatment.
However, the 21-year-old from Japan was beaten 7-5 6-4 by the Swiss 13th seed.
Osaka said: “I hurt my knee in Cincinnati, but it’s getting better. I don’t want to say that that’s the reason that I lost, because I obviously had played three matches before this.
“Right now I have this feeling of sadness, but I also feel like I have learned so much during this tournament. Honestly, of course I wanted to defend this tournament.
“I feel like the steps that I have taken as a person have been much greater than, like, I would imagine at this point.
“So I hope that I can keep growing. I know that if I keep working hard, then of course I’ll have better results.”
Her defeat came just a day after men's champion Novak Djokovic also bowed out after retiring at two sets down to Stan Wawrinka.
Osaka was cheered to the rafters as she trudged off court, a crowd favourite now after the way she consoled American youngster Coco Gauff following their match on Saturday night.
It was a third straight win for Bencic over Osaka this year, and she said: “The challenge cannot be bigger against Naomi, she won this title last year.
“I’m really pleased with my game and how I handled my nerves.
“I tried taking the serve early and trying to anticipate, because she has a lot of power. I don’t hit so many winners. I try to play it a little bit like chess.
“I was in the stadium watching the (Gauff) match and thought it was an unbelievable moment for tennis. What Naomi did is what a true champion would do.”
Bencic will play Donna Vekic in the quarter-final after the Croatian came from a set down to beat Julia Goerges of Germany.
Goerges had a match point in the second set but ended up losing 6-7 (5) 7-5 6-3.
The runs of American wild card Kristie Ahn and qualifier Taylor Townsend came to an end late on Monday night.
New Yorker Ahn was beaten 6-1 6-1 by Elise Mertens while Chicago's Townsend lost to 15th seed Bianca Andreescu of Canada 6-1 4-6 6-2.