Having already beaten Federer twice this season, the towering Czech again appeared to have the Swiss' measure when he powered his way to a 5-2 lead in the third set.

But a relentless Federer refused to fold, finally getting the break he needed with Berdych serving for the match at 5-3.

With a breathless center court crowd on its feet, there was more drama to come during a pulsating tiebreak that saw Federer jump ahead 4-0 then hang on to clinch the victory 7-5 when Berdych sent a return into the net.

The quarter-final match marked the third meeting between the two in the past five months, the hard-hitting Czech winning the two previous encounters, including a shock quarter-final upset at Wimbledon.

Federer, twice a champion on the Canadian hardcourts, will next meet the winner of world number two Novak Djokovic of Serbia and Frenchman Jeremy Chardy who play later on Friday.