NEW YORK — Caroline Wozniacki trusts her stamina so much that she plans to return to New York in two months to run a marathon.
Maria Sharapova, usually the one wearing down opponents in the third set, sure couldn’t keep up on a steamy Sunday at the US Open. Wozniacki won, 6-4, 2-6, 6-2, in 2 hours, 37 minutes to get back to her first Grand Slam quarterfinal in more than two years — and get back in the headlines for reasons other than her personal life.
‘‘The season for me has been a little bit up and down,’’ she said in quite an understatement, ‘‘and it’s so nice to kind of start feeling like I'm playing the way I want to.’’
Because of the heat, the players received a 10-minute break before the final set; Sharapova returned to the court late, arguing with the chair umpire after receiving a time violation warning. Perhaps sensing that she was fresher than the five-time major champion, Wozniacki later complained that Sharapova was dawdling between points.
Sharapova’s tardiness seemed to swing the Arthur Ashe Stadium crowd’s support squarely in Wozniacki’s favor. When the 10th-seeded Dane broke Sharapova to go up, 3-1, in the final set, she got a standing ovation from the fans and waved her arms to egg them on. Sharapova had appeared to hit a winner three times on that game’s final point only for Wozniacki to somehow chase down the ball. Finally, Sharapova hit a volley into the net.
The loss by the fifth-seeded Sharapova leaves No. 1 Serena Williams as the only woman remaining of the top six.
After a sloppy first set with 21 unforced errors, Sharapova was painting the lines in the second. Wozniacki seemed to spend most of the set watching in dismay as one of Sharapova’s 22 winners whizzed by.
Wozniacki said she told herself before the third set to go for her shots.
‘‘If I'm going to lose,’’ she recalled thinking, ‘‘at least I'm going to do it with dignity.’’
She closed out the match by breaking Sharapova’s serve again with a backhand winner. About a half-hour later, play was halted at Flushing Meadows because of thunderstorms with second-seeded Roger Federer among the players on the court. Matches resumed after a delay of about two hours.
Federer regrouped after the fortuitously timed delay to move on in four sets over Marcel Granollers. When they returned to the court following the interruption, Granollers won the first set. But Federer dominated the rest of the way in a 4-6, 6-1, 6-1, 6-1 victory.
Federer next faces Roberto Bautista Agut of Spain, who beat Adrian Mannarino, 7-5, 6-2, 6-3. The 17-time Grand Slam champion has dropped one set through three matches.
Dominic Thiem, 20, made his first Grand Slam round of 16 with a 6-4, 6-2, 6-3 win over 19th-seeded Feliciano Lopez. Another first was achieved in the women’s draw by Peng Shuai, who had never been to a major quarterfinal before beating 14th-seeded Lucie Safarova, 6-3, 6-4.
With mentor Martina Hingis cheering from the stands, 17-year-old Belinda Bencic became the youngest US Open quarterfinalist since Hingis herself in 1997.
Playing on Arthur Ashe Stadium, ninth-seeded Jelena Jankovic was far more rattled than an opponent 12 years her junior as Bencic won, 7-6 (8-6), 6-3.
Hingis was 16 when she won the US Open in 1997 — Bencic was 6 months old at the time. Hingis’s mother, Melanie Molitor, coaches Bencic.
Wozniacki will next face 13th-seeded Sara Errani, who ended the run of 32-year-old qualifier Mirjana Lucic-Baroni with a 6-3, 2-6, 6-0 victory.
Errani used consistent shots and a notoriously soft serve to end the tournament’s most unlikely comeback story.
Errani, the 2012 French Open runner-up, was content to play counterpuncher to the big-hitting Lucic-Baroni, who racked up 69 unforced errors. Errani made nearly 90 percent of her first serves, which averaged a mere 76 miles per hour.
As a 19-year-old, Wozniacki made the 2009 US Open final, losing to Kim Clijsters, and reached No. 1 in the world the next year. But she hadn’t been back to a Grand Slam quarterfinal since the 2012 Australian Open.
In the meantime, she was best known for getting engaged to star golfer Rory McIlroy — then getting dumped in late May after wedding invitations had gone out.
Meanwhile, Wozniacki announced a month ago that she planned to run the New York City Marathon on Nov. 2, somehow squeezing in training during a busy fall season.
Wozniacki plans to stick around New York after the US Open to attend Fashion Week — including her pal Williams’s show — and get in some running in Central Park. The marathon prep has gone on hiatus the last few days, though.
As Wozniacki deadpanned, ‘‘I have a pretty big tournament here that I kind of want to try and win.’’