The Swiss maestro, who recently clinched his 19th Grand Slam title at the Wimbledon, lost the first round by 4-6 margin before he rebounded strongly to keep his bid alive for a first title in Montreal and improve his 2017 hard-court record to 21-1.
The final score of a thrilling second-round clash that lasted one hour and 57 minutes read 4-6, 6-4, 6-2, in favour of Federer.
With the win, Federer has also extended his impressive ATP Head-to-Head advantage over Ferrer to 17-0.
Federer will now cross swords with Roberto Bautista Agut of Spain for a place in last-four.
In another men's singles clash, fifteen-time grand slam champion Rafael Nadal's bid to regain top spot suffered a major blow as he knocked out of the tournament after going down against Israel's Denis Shapovalov.
After comfortably winning the first set, the top-seeded lost momentum and slumped to a 6-3, 4-6, 6-7 (4-7) defeat at the hands of Shapovalov in a clash that lasted two hours and 45 minutes.(ANI)