Serena Williams conceded she "survived tonight" following a second-round scare against teenager Catherine McNally before booking her place in the third round of the US Open on a rain-affected third day in New York.
Williams dropped the first set to the American wildcard before turning on the afterburners to power to a 5-7, 6-3 6-1 victory.
The victory keeps alive Williams' hope of winning a record-equalling 24th grand slam title, but the world No 8 was made to sweat before overcoming 17-year-old McNally.
"She really came out and played really well, she showed no fear," a relieved Williams said. "She had absolutely nothing to lose and she played like it."
McNally was not even born when Williams lifted the second of her six US Open titles in 2002. Competing in only her sixth tour-level event of her career, McNally took the game to Williams in the opening exchanges, relying on her serve and volley to unsettle Williams, the highest-ranked player she has faced.
Another weapon in McNally's armory was a sliced backhand that had shades of Swiss legend Roger Federer. So disarmed was Williams that the 38-year-old made 28 unforced errors, two fewer than her inexperienced opponent.
But Williams, whose earliest exit came at Flushing Meadows on debut in 1997 when she lost in the third round, turned the match around when she finally broke McNally's serve and then consolidated in a tight service game for a 5-2 lead in the second set.
Williams looked more like herself in the decider as she went up a double break for a quick 3-0 lead before storming home and sealing the match when she broke to love.
"I survived tonight," said Williams. "I am not too pleased with the way I played at all," said Williams.
"But it's OK, I'm alive, I'm still here and happy to be on this court. I'll do better. I promise."
The match was a far more taxing affair than Williams' opening match when she routed Maria Sharapova 6-1, 6-1 to extend her head-to-head over her long-time Russian rival to 20 wins in 22 matches.
Up next for Williams will be either Taiwan's Hsieh Su-wei or Czech Karolina Muchova, who were unable to get their match in earlier due to rainy conditions.
On a rain-hit day in which tournament organisers cancelled all matches on the outdoor courts, French Open winner Ash Barty beat American Lauren Davis 6-2, 7-6 while fifth seed Elina Svitolina knocked out Venus Williams with a 6-4, 6-4 win.
Karolina Pliskova, the 2016 finalist who is still chasing her maiden grand slam title, put on a serving masterclass to outclass Georgia's Mariam Bolkvadze 6-1, 6-4.