Serena Williams was taken to a deciding set by Kaia Kanepi but came through to reach the quarter-finals of the US Open as she chases the all-time grand slam record.
After winning the opening set in just 18 minutes and for the loss of six points, Williams found herself taken to a deciding set for the first time this tournament.
But she responded impressively to win 6-0 4-6 6-3 and set up a quarter-final clash with eighth seed Karolina Pliskova, the last player to beat her at Flushing Meadows in the semi-finals two years ago.
Williams is through to the last eight in New York for the 15th time and is now only three victories away from a 24th grand slam singles title, equalling the all-time record held by Margaret Court.
The 36-year-old was utterly dominant in the opening set but a break of serve for Kanepi at the start of the second set changed the momentum of the match.
The Estonian, who beat top seed Simona Halep in round one but had never previously taken a set off Williams, began to match her opponent power for power and surged into a 5-2 lead before levelling the match.
Williams roared when she fought off Kanepi pressure in the opening game of the decider and pulled away, finishing the match with a tally of 47 winners, including 18 aces.
Serena still struggling for fitness
Williams has looked closer to her physical peak this tournament than at any time since her comeback in March following the birth of daughter Olympia a year ago.
She admitted she has found it harder than she expected to regain her fitness, and said: "I think society puts it out there that you'll just kind of snap back, and that's just a myth.
"I feel like it's important for women to know that it doesn't happen like that. In the Instagram world (it does) but, in the real world, it takes a while for your body to come back. Especially after a C-section.
"And not only that, like mentally and physically and dealing emotionally with providing for a child, it's a lot that goes into it. And I was just living in this world where I thought it would just automatically come together."
She added of her lavender-coloured tutu: "My dress, I kind of look like a magical fairy, but it's not happening. So I had to realise and live in reality."
Pliskova presents tough challenge
Williams can expect her toughest challenge yet in the last eight against Pliskova, who defeated Australia's Ashleigh Barty 6-4 6-4.
Pliskova was tipped as a grand slam winner of the near future after her victory over Williams but it has not quite happened for the Czech, who climbed to world number one last summer.
Recalling their clash, Williams said: "She came out strong. I have watched her a great deal since then. I have taken a lot from that match and I think we are in different positions now."
Pliskova is pleased to get another crack at Williams having not played her since 2016 and will go into the match confident she can pull off another upset.
She said: "I really was feeling great that year. I'm feeling great now, too. But it was a little bit of a different story in 2016. I was a dark horse. Nobody was expecting me to get that far.
"I know she was the best at that time, but I just wanted to win. So that's why I won, because I believed I had a chance. I have a game to beat her."
There will be another rematch in the last eight between defending champion Sloane Stephens and Latvia's Anastasija Sevastova.
Stephens swept past Elise Mertens 6-3 6-3 while Sevastova sent another top seed packing, beating Elina Svitolina 6-3 1-6 6-0.
Stephens arguably came closer to losing to Sevastova than in any other match last year before winning the deciding tie-break.