Roger Federer survived the end of his streak of winning 32 consecutive sets to beat David Ferrer and reach the last eight of the Rogers Cup.
Wimbledon champion Federer, who celebrated his 36th birthday on Tuesday, prevailed 4-6 6-4 6-2 in just under two hours in Montreal.
Ferrer came out all guns blazing and after racing into a 4-1 lead took the first set 6-4 against world number three Federer, who had not dropped a set since his shock defeat to Tommy Haas at the Mercedes Cup in June.
But Federer broke Ferrer in the first game of the second and although he lost his serve in the fifth game, he broke back immediately and served out to level the match.
Federer, a three-time previous winner of the tournament, pounced on the Ferrer serve in the opening game of the decider and broke the former world number three a second time to take a 5-2 lead, before sealing a last-eight clash against another Spaniard, Roberto Bautista Agut.
Bautista Agut fought back from a set down and out-lasted Frenchman Gael Monfils 4-6 7-6 (7/5) 7-6 (7/2) in just short of three hours.
Argentina's Diego Schwartzman recovered after failing to take a game in the opening set to beat USA's Jared Donaldson 0-6 7-5 7-5.
World number 36 Schwartzman will play Holland's Robin Haase who overcame Grigor Dimitrov 7-6 (7/3) 4-6 6-1.