(CNN) -- Roger Federer suffered unexpected losses in his three previous tournaments and needed to rally to set up a clash with Rafael Nadal at the Cincinnati Masters.
Federer, troubled recently by a back injury and absent from last week's Rogers Cup in Montreal, beat Tommy Haas 1-6 7-5 6-3 to set up a quarterfinal against a surging Nadal.
After dropping the first set, Federer fell behind a break in the second but Haas couldn't hang on and one break was enough for the Swiss to claim the third.
Having changed his equipment for clay-court tournaments in Switzerland and Germany following his shock second-round loss at Wimbledon to Sergiy Stakhovksy -- he opted for a larger racquet -- the 17-time grand slam winner is playing in Ohio with his old racquet.
He is seeking a record sixth title in Cincinnati.
"Now I'm fit again and I'm mentally motivated," he told reporters before his opening match in Cincinnati.
Federer's last eight tie against Nadal will be the 31st match between the all-conquering duo.
Nadal, a 12-time grand slam winner, notched his 12th consecutive hard court victory by beating Grigor Dimitrov 6-2 5-7 6-2.
The Spaniard has defeated Federer 20 times during his career.
"We played so many times for very important things," Nadal said in a courtside interview. "That makes every match very special. The combination of styles makes the matches very interesting."
World No. 1 Novak Djokovic, coming off a tough loss against Nadal in the Rogers Cup semifinals and without a title since April, had little difficulty advancing to the quarterfinals as he thumped Belgian David Goffin 6-2 6-0 in under an hour.
He didn't face a break point.
"Even though the scoreline says it was quite straightforward, it's still never easy," Djokovic told the ATP's website. "You need to work for your wins and points.
"That was kind of the mindset I had today before I came to the court. I wanted to just play from the first to last point committed and aggressive, and I did well."
Next up for Djokovic is U.S. No. 1 John Isner, who beat 10th-ranked Milos Raonic 7-6 (7-5) 6-4.
Wimbledon winner Andy Murray, the world No. 2 who was upset by Ernests Gulbis in Montreal, advanced 6-2, 6-2 over Frenchman Julien Benneteau.
Third seed David Ferrer is out after slipping to a straight-sets defeat against Dmitry Tursunov.
In the women's draw, second-ranked Victoria Azarenka progressed with a 6-3 6-4 victory over an in-form Magdalena Rybarikova, converting eight of her 10 break points. Slovakia's Rybarikova went 5-for-14.
Like Federer, Azarenka didn't play in Canada. She pulled out because of a lower back injury.
Azarenka advanced to a tie against Denmark's Caroline Wozniacki. The 10th seed came from one set down to beat No. 7 Petra Kvitova 3-6 6-2 6-3.
American rising star Sloane Stephens was knocked out by former world No. 1 Jelena Jankovic in the first ever match between the two players.
Serbia's Jankovic clinched a grueling encounter 3-6 7-5 7-5.
Jankovic's quarterfinal opponent will be Roberta Vinci, the 12th seed who beat fellow Italian Sara Errani 6-4 6-3.