NEW YORK – Caroline Wozniacki of Denmark trusts her stamina so much she plans to return to New York to run a marathon.

Russian Maria Sharapova, usually the one wearing down opponents in the third set, sure couldn’t keep up on a steamy Sunday at the U.S. Open. The 10th-seeded Wozniacki won 6-4, 2-6, 6-2 in 2 hours, 37 minutes to get back to her first quarterfinal in a Grand Slam tournament 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.”

Wozniacki was engaged to Rory McIlroy, who is the top-ranked golfer in the world, but McIlroy broke up with her in May — after wedding invitations had gone out.

Save 75% on a Digital Subscription Today

Wozniacki mixed in just enough aggression with her signature defense to keep the pressure on the fifth-seeded Sharapova in the final set.

“She’s very good at getting a lot of balls back and making you hit another one,” Sharapova said. “In the end, I went for a little too much.”

Of the top six women’s seeds in singles, the only one who hasn’t been eliminated is No. 1 Serena Williams.

Meanwhile, the men’s draw didn’t lose a top-10 seed until Sunday, when No. 4 David Ferrer of Spain was upset by No. 26 Gilles Simon of France in the third round 6-3, 3-6, 6-1, 6-3.

Second-seeded Roger Federer of Switzerland regrouped after a weather delay to advance to the fourth round.

Federer lost the first set to 42nd-ranked Marcel Granollers of Spain before taking control in a 4-6, 6-1, 6-1, 6-1 victory.