Montreal - Roger Federer maintained his career-long winning streak over David Ferrer to advance to the quarter-finals of the ATP Montreal Masters on Thursday after a three-set battle with the veteran Spaniard.
Federer, 36, had never lost in 16 previous meetings with the 35-year-old Ferrer, whom he first defeated 14 years ago at the Vienna Indoor tournament.
But while Ferrer managed to take the opening set, the Swiss ace raised his game to win 4-6, 6-4, 6-2.
"I actually feel really happy because I know I can play a lot better. David can play a lot better, too," Federer said. "We battled, both tried to find a way to win. You know, he had a good start, I had a better finish."
A strangely error-prone Federer was unable to generate his usual fluency early on, and quickly found himself giving away an early break to trail 4-1 in the first set.
Nowhere was Federer's wayward performance better illustrated than in the seventh game, when he squandered three break points at 0-40 to allow Ferrer to take a 5-2 lead.
Federer held for 5-3 and looked to have clawed his way back into the set with a break of Ferrer's serve in the next game to make it 5-4.
But Federer was struggling again as he served to level the set, finding himself set point down. He saved the first with an ace but Ferrer made no mistake later in the game, converting to take the opener 6-4.
Federer responded quickly in the second set, going a break up to lead 3-2 before holding for a 4-2 lead.
With Federer slowly improving his first serve, Ferrer was unable to carve out the opportunities he had found in the first set.
The set went with serve as Federer levelled.
An early break in the decider put him in control as a weary Ferrer began to tire.
Some vintage play at the net helped put Federer 4-2 up with Ferrer seemingly unable to summon a response.
The decisive break came in the seventh game, with Ferrer netting a forehand to leave Federer 5-2 up and serving for the match.
Federer promptly went in for the kill, attacking the net and opening up the court to clinch victory with a deft volley.
Federer will now play another Spaniard, Roberto Bautista Agut, in the quarter-finals. Bautista Agut defeated France's Gael Monfils in a gruelling slug-fest, winning 4-6, 7-6 (7/5), 7-6 (7/2).
"I hope that this match gives me some better rhythm and confidence against Bautista Agut, who plays actually very similar to David," Federer said.
Results on Thursday in the ATP Montreal Masters (x-denotes seeded player):
Denis Shapovalov (CAN) bt Rafael Nadal (ESP x1) 3-6, 6-4, 7-6 (7/4)
Roger Federer (SUI x2) bt David Ferrer (ESP) 4-6, 6-4, 6-2
Robin Haase (NED) bt Grigor Dimitrov (BUL x7) 7-6 (7/3), 4-6, 6-1
Diego Schwartzman (ARG) bt Jared Donaldson (USA) 0-6, 7-5, 7-5
Roberto Bautista (ESP) bt Gael Monfils (FRA) 4-6, 7-6 (7/5), 7-6 (7/2)
Adrian Mannarino (FRA) bt Hyeon Chung (KOR) 6-3, 6-3
Alexander Zverev (GER x4) bt Nick Kyrgios (AUS x16) 6-4, 6-3
Kevin Anderson (RSA) bt Sam Querrey (USA) 6-4, 6-1