Training for a marathon might not seem the most obvious path to success on the court but Caroline Wozniacki might just be the exception to the rule after she produced arguably the best win of her career to take out Maria Sharapova and reach the quarter-finals of the US Open.

After an unlikely summer of rejuvenation, 10th seed Wozniacki, who will run the New York City marathon in November, proved the stronger in brutally humid conditions as she won 6-4, 2-6, 6-2 to reach her first grand slam quarter-final in two years. Having been cast out as a grand slam never was, the Dane is a contender again.

For Sharapova, it was an end to her hopes of a second grand slam title in 2014 but for Wozniacki it was perhaps her best victory. It is certainly one that she will savour.

"It's amazing," Wozniacki said, after Neil Diamond's Sweet Caroline had been blasted out over Arthur Ashe Stadium Court. "It means so much to me. It's been a bit of an up-and-down year for me but this US hardcourt season has been great and to win against a champion like Maria is a really good feeling."

Wozniacki, who next plays Italy's Sara Errani, has been in the news more for her love life than her tennis this year, thanks to Rory McIlroy breaking off their engagement with a brusque phone call. And when Sharapova hit back to level the match at one set apiece, there were probably very few people in the stadium who doubted the Russian would win.

But Wozniacki, annoyed by how long it took Sharapova to come back from their 10-minute heat break after the second set, channelled that anger into a brilliant final set.

Serving with more authority than usual, her often weak forehand was solid and her backhand was back to its best as she matched Sharapova from the baseline.

However, it was her movement that was absolutely outstanding, with one brilliant point in the fourth game - which gave her a break for a 3-1 lead - showing the benefits of all the off-court work she has been doing. "It's definitely helping me," she said of her marathon training. "I don't know what I've got myself into, running the marathon, but it's for charity … so if anyone wants to donate, that would be great. But I think today I am just going to take it easy and maybe have some chocolate or something."

Sharapova was not the only surprise casualty yesterday as fourth seed David Ferrer was dumped out in four sets by Frenchman Gilles Simon. The pair exchanged lung-busting rallies but surprisingly it was the Spaniard, whose outstanding court coverage has been the bedrock of his success, who wilted in the heat.

"It was hot and it was so humid," Simon said. "I never sweated like this in the last 10 years."

Ferrer was straight to the point. "I was not good with my fitness. Nothing else, no? He was better."