Serena Williams fought back from a set down to beat American teenager Caty McNally in an entertaining late-night match at the US Open.
Williams, 37, took control midway through the second set to win 5-7 6-3 6-1.
The eighth seed dropped just five points in a one-sided final set.
"I survived tonight. I am not too pleased with the way I played at all, but it's OK, I'm alive. I'll do better. I promise," said Williams.
The 23-time Grand Slam champion will play Czech Karolina Muchova or Taiwan's Hsieh Su-wei in the third round.
Williams thrashed long-time rival Maria Sharapova in the opening round on Monday, but was given a much sterner test by McNally on the 17-year-old's first main-draw appearance at Flushing Meadows.
McNally, ranked 121st in the world, constructed some excellent points as she tried to move Williams around the court and it proved successful when she claimed the first break point of the match for a 6-5 lead.
After fighting off three break-back points, McNally sealed the set at the second attempt to move halfway to a famous victory against one of the all-time greats, who had already won the 1999 US Open before McNally was born in November 2001.
Eventually Williams found a level closer to her best, breaking for a 4-2 lead in the second set and levelling after missing four set points on McNally's serve.
The final set was a different story to the previous two, Williams winning 16 of the opening 17 points and needing little over 20 minutes to clinch victory.
Williams will find out her next opponent on Thursday. The meeting between Hsieh and Muchova was one of the many first-round matches cancelled on Wednesday after rain decimated play in New York.
Earlier in Wednesday's night session, Australian second seed Ashleigh Barty battled past American Lauren Davis in straight sets.
The French Open champion, 23, saved a set point in the second before taking her fourth match point to win 6-2 7-6 (7-2) on Louis Armstrong Stadium.