Federer, a two-time French Open runner-up, defeated Frenchman Julien Benneteau 6-4, 7-5, 7-5 despite 42 unforced errors. Federer and Benneteau had to wait out an hour-and-a-half rain delay.
Federer, 26, lost to Spaniard Rafael Nadal in the last two finals here. The reigning five-time Wimbledon and four-time U.S. Open champion, Federer needs the French Open to complete a career Grand Slam.
"I hope it's going to go my way this time," Federer said after reaching his 16th straight Grand Slam quarterfinal.
Ferrer struggled before beating Czech Radek Stepanek 4-6, 6-2, 1-6, 6-3, 6-3.
Earlier Monday, Chilean Fernando Gonzalez eliminated American Robby Ginepri 7-6 (7-4), 6-3, 6-1.
The men's quarterfinals will get under way Tuesday with second-seeded Nadal, a three-time French Open champ, meeting fellow Spaniard Nicolas Almagro, and third-seeded Serbian Novak Djokovic playing Latvian Ernests Gulbis.