(CNN) -

Fourth seed David Ferrer was sent crashing out of the U.S. Open by Frenchman Gilles Simon on Sunday, becoming the biggest men's scalp to be taken so far during the final grand slam of the tennis season, while former women's champion Maria Sharapova also exited.

In oppressively humid conditions at Flushing Meadows, Simon and Ferrer traded the first two sets 6-3 before Simon found another level to wrap up the final two sets 6-1 6-3.

The 26th seed took advantage of some sloppy play by Ferrer, who made 52 unforced errors and appeared to be struggling physically with the heat in the third-round tie.

It was a timely victory for Simon, who had lost five of his past six meetings against the Spaniard.

"He destroyed me five times before," Simon said after the match.

"I just tried to stay loose and relaxed and enjoy myself on court. But I am tired. The weather forecast said it would be cooler today but it didn't feel like it. We ran so much and I am happy to finish in four sets because I knew that against David it would be really hard in the fifth."

Simon will play Croatian 14th seed Marin Cilic, who beat South Africa's Kevin Anderson in four sets.

"I always have a tough fight with Marin," Simon said after Cilic's victory.

Simon has beaten Cilic in his last four encounters but is not taking anything for granted. "Yes, but did you check the scores?! It was always in five sets! We know each other well. It will be a tough fight."

Roger Federer continued his bid to become the first man to win six U.S. Open titles as he reached the last 16 with a rain-interrupted win against Spain's Marcel Granollers.

The 17-time grand slam champion came from behind to triumph 4-6 6-1 6-1 6-1 against the world No. 42, setting up a fourth-round clash with another Spaniard, Roberto Bautista Agut.

The 17th seed equaled his best grand slam performance, matching his achievement of reaching the last 16 at January's Australian Open, as he beat France's Adrian Mannarino in straight sets.

"I feel very explosive, quick," second seed Federer said. "The coordination is there, as well. I feel like I've gotten used to the hard courts by now. It's really working well. I'm very pleased."

Seventh seed Grigor Dimitrov also came from behind to beat Belgium's David Goffin in four, and the Bulgarian will next play French 20th seed Gael Monfils.

Monfils upset 12th-seeded compatriot Richard Gasquet in straight sets to reach the last 16 in New York for the first time since 2009.

Czech sixth seed Tomas Berdych also progressed, beating Russia's Teimuraz Gabashvili 6-3 6-2 6-4 to set up a clash with Austrian debutant Dominic Thiem.

Thiem, who turns 21 on Wednesday, eliminated Spanish 19th seed Feliciano Lopez 6-4 6-2 6-3 as he continued his best showing at a grand slam, having lost in the first round at Wimbledon and the second at the Australian and French Opens.

Meanwhile former world No. 1 Caroline Wozniacki put a nightmare 2014 firmly behind her by knocking out five-time grand slam winner Sharapova 6-4 2-6 6-2 and book her place in the quarterfinals.

French Open champion Sharapova was the strong favorite at the Arthur Ashe Stadium, but the Dane dug deep to win the third set and give her a great chance of winning her first grand slam.

"She made me hit a lot of balls," Sharapova told reporters. "That's always been her strength. But she did extremely well today. She's a great retriever, especially in these types of conditions. I just felt like I maybe went for a little too much."

Of all the female players left in the draw, only world No. 1 Serena Williams and formerly top-ranked Victoria Azarenka have ever won a grand slam.

"It means so much to me," said Wozniacki after her victory over the fifth seed, who won the 2006 U.S. Open and reached the semifinals in her last appearance in 2012.

"It's been a bit up and down for me this season ... To win today against a champion like Maria is an unbelievable feeling."

Wozniacki, seeded 10th this year, was runner-up in 2009 and made the semis in 2010-11 but has not reached the last four of a grand slam since then.

The 24-year-old, who split with golf star Rory McIlroy this year ahead of a planned wedding, will next face Italian 12th seed Sara Errani.

Errani, a semifinalist in 2012 after losing in the French Open final earlier that season, ended the dream run of former child prodigy Mirjana Lucic-Baroni as she beat the 32-year-old Croatian 6-3 2-6 6-0.

Lucic-Baroni, who came through qualifying and beat world No. 2 Simona Halep in round three, was playing in the last 16 of a grand slam for the first time since 1999 -- when she was a semifinalist at Wimbledon.

Belinda Bencic beat former world No. 1 Jelena Jankovic 7-6 (8-6) 6-3 to become the youngest U.S. Open quarterfinalist since 1997, when Martina Hingis went on to win the title.

The Swiss 17-year-old, who has trained at the academy run by Hingis' mother, will next play China's Peng Shuai -- who likewise progressed to the last eight of the singles competition for the first time in a grand slam.

While Bencic is playing in majors for the first time this year, the 28-year-old Peng made her debut a decade ago and has twice won doubles titles, including the French Open in June.

Peng ousted 14th-seeded Czech Lucie Safarova 6-3 6-4, having upset world No. 5 Agnieszka Radwanska in round two.

"The last couple of times I was in the fourth round I would always lose to good players," said Peng, who reached the last 16 at Wimbledon after first-round exits in Melbourne and Paris.

"I knew if I was going to win these matches I needed more courage on the court."