Serena Williams flubbed yet another shot and wailed, "I keep missing my forehand!"

She was in trouble, if only briefly, against 17-year-old American Caty McNally, who is friends, and doubles partners, with Coco Gauff.

Making key adjustments to her serve and straightening out her other strokes, Williams avoided what would have been her earliest loss in 19 appearances at the U.S. Open, coming back to beat McNally 5-7, 6-3, 6-1 in a match that ended as Wednesday turned to Thursday.

"You can't win tournaments making that many errors," Williams said. "I knew I had to play better, and I knew I could."

And so she did.

"Obviously, she's going to pick up her level. I knew that was going to happen," McNally said. "Next time, I just have to raise my level with hers."

Williams improved to 38-0 in the first two rounds at Flushing Meadows. The only time she was beaten as early as even the third round in New York was in her tournament debut all way back in 1998 — when she was just 16 herself.

The following year, Williams won the first of her six U.S. Open championships. McNally hadn't even been born yet.

Now 37, Williams owns 23 Grand Slam singles titles in all, and she showed off why while powering her way through a deficit, taking 16 of the final set's initial 17 points.

McNally had never won a match at any major tournament until Monday. She is ranked 121st and received a wild-card invitation from the U.S. Tennis Association for singles and for doubles, the latter with 15-year-old sensation Gauff.

It was Gauff who beat Williams' older sister, Venus, on the way to the fourth round of Wimbledon last month.

Might another stunner be in the offing? Seemed a possibility for a set, anyway, with McNally charging the net, serving-and-volleying, and looking like someone who belonged.

Maybe that's why Williams never looked comfortable early. Took time to get into a real groove. Went stretches without being the dominant force she's been for a couple of decades and sure was just the other night while absolutely overwhelming five-time major champion Maria Sharapova 6-1, 6-1 in the same arena.

The Arthur Ashe Stadium crowd, made louder than usual under the retractable roof that was closed all day because of showers, alternated who it was pulling for, more than happy to cheer for either woman representing the United States at the country's Grand Slam tournament.

Who doesn't love to support an all-time great, after all? And who doesn't enjoy getting behind a true underdog?

"She's young. It's her first time in a stage like this and only her second Grand Slam, so I think there's a lot to gain from it," said Lynn Nabors-McNally, Caty's mother, who also helps coach her. "It's a great stepping stone to a lot of things."

So there was McNally, almost strutting to the sideline while waving her arms, trying to get the spectators to offer even more noise and more applause after she pulled out the opening set in impressive fashion. First, McNally converted her only break point of the match to lead 6-5. Then she served out the set despite falling behind love-40, erasing three break points and hitting a 103-mph service winner to seal it — and implored the fans to get loud.

They obliged.

"I knew I was playing against the greatest of all time. ... I walked out there and I had the chills," McNally said. "Super happy just to get a set from her. That's something that not very many people do."

And for a bit of the second set, too, McNally stayed with Williams.

But Williams started to pull away, in part by dispensing with the serves out wide that McNally was handling well, and in part by reducing her mistakes from 15 unforced errors in the first set, to 11 in the second to two in the third.

"Actually, I'd rather not be tested in every match. But that doesn't happen. So it's important for me to have those, like, really rough, rowdy matches," Williams said. "That helps a lot."