The British number two led by a set and a break but failed to make the most of his advantage and was eventually beaten 6-7 (7/5) 6-4 6-3.

Eurosport Player One Year Pass for just £29.99

Edmund had gone into the game full of confidence after a strong start to the hard-court season including a narrow loss to Grigor Dimitrov in Washington last week.
Montreal Masters
Federer through to Rogers Cup final
12/08/2017 AT 21:23

Kyle Edmund of Great Britain reacts

Image credit: Getty Images

He recovered from an early break by the 35-year-old Spaniard to force a first set tie-break in which he held his nerve to take the lead in the match.
Edmund broke again early in the second but Ferrer, now down at 33 in the world, used all his experience to break twice in quick succession as he pulled back level.

David Ferrer of Spain serves against Kyle Edmund of Great Britain during day four of the Rogers Cup presented by National Bank at Uniprix Stadium on August 7, 2017 in Montreal, Quebec, Canada.

Image credit: Getty Images

Another break by Ferrer early in the third appeared to leave Edmund down at out at 3-0 but the 22-year-old came back to give himself hope.
However, having narrowed the deficit to 3-4, Edmund was immediately broken again, giving Ferrer the opportunity to serve out for victory.
Montreal Masters
Federer cruises to semi-finals in Montreal
11/08/2017 AT 21:47
Montreal Masters
Canadian teenager Shapovalov stuns Nadal in Montreal
11/08/2017 AT 15:31