NEW YORK — Serena Williams’ yells of “Come on!” crescendoed right along with the tension in a fourth-round U.S. Open match that began as a rout and then suddenly became riveting.

When she ripped a backhand winner to claim the third set’s opening game Sunday, Williams let out her loudest shout of the day, leaning forward and rocking both arms. This match turned into a test, and she passed it.

Williams reached the quarterfinals at Flushing Meadows for a 10th consecutive appearance – she wasn’t there last year because she gave birth to her daughter during the tournament – by picking her level up after a lull and using 18 aces to beat Kaia Kanepi of Estonia 6-0, 4-6, 6-3.

“It wasn’t an easy match at all. She obviously knows how to play,” said Williams, a six-time U.S. Open champion who finished with more than twice as many winners as Kanepi, 47-22. “I was just happy to get through it.”

This was filled with big hitting by both women, along with all manner of shifts in momentum and quality of play. In the 18-minute shutout of the first set, Kanepi was tight and Williams was pretty much perfect, grabbing 24 of 30 points.

But after compiling 14 winners and only two unforced errors in that set, Williams began making mistakes, becoming less and less comfortable as Kanepi grew increasingly so. Kanepi is ranked only 44th, but she’s been a top-20 player in the past and has made it to Grand Slam quarterfinals a half-dozen times. Sure, that’s nothing compared to Williams’ 23 major titles, but it’s something. Plus, it’s worth remembering this: Kanepi eliminated No. 1 Simona Halep on Day 1 of this tournament.

In a blink, Williams had a match on her hands. Kanepi was matching Williams’ power with booming groundstrokes of her own. She was getting better reads on Williams’ serves. And the 36-year-old American began making more and more mistakes.

When Williams shanked a backhand return of a 103 mph serve, the match was a little more than an hour old, and it was all tied at a set apiece. That was the first set she had lost against Kanepi of the 10 they’d played to that point, and the first set Williams had lost at the 2018 U.S. Open, a run that included a 6-1, 6-2 victory over her older sister Venus in the third round Friday night.

After that scream-inspiring hold to begin the final set, Williams broke right away to lead 2-0. She then faced a break point, but Kanepi wasted the chance by sending a backhand wide. Williams then smacked an ace at 118 mph, followed by a service winner at 113 mph to go up 3-0, and that, essentially, was that.

Next comes a quarterfinal against 2016 runner-up Karolina Pliskova, who beat Williams in the U.S. Open semifinals that year.

“I really was feeling great that year. I’m feeling great now, too. But it was a little bit different story, 2016. I was, like, a dark horse. Nobody was expecting me to get that far,” Pliskova said after beating No. 18 Ashleigh Barty 6-4, 6-4.

The other quarterfinal in the top half of the draw will be defending champion Sloane Stephens against No. 19 Anastasija Sevastova of Latvia in a rematch from the same round last year.

Stephens got there by beating No. 15 Elise Mertens of Belgium 6-3, 6-3 at night, while Sevastova defeated No. 7 Elina Svitolina 6-3, 1-6, 6-0.

The defending men’s champion, Rafael Nadal, reached his fourth Grand Slam quarterfinal of the season, and the 36th of his career, by getting past Nikoloz Basilashvili 6-3, 6-3, 6-7 (6), 6-4, while No. 11 John Isner of the U.S. made it that far at Flushing Meadows for the first time since 2011. Isner defeated No. 25 Milos Raonic of Canada 3-6, 6-3, 6-4, 3-6, 6-2.