Roger Federer needed just under two hours to see off Germany's Florian Mayer in three-sets on Friday to reach the semi-finals of the Hamburg claycourt tournament.
The Swiss top seed, playing his first tournament since his shock second-round exit at Wimbledon, dug deep to claim the third
set for a 7-6 (7/4), 3-6, 7-5 quarter-final victory.
Mayer, 45th in the world compared to Federer's fifth ranking, fired down six aces, three times more than the Swiss star, but Federer was strong where it counted, saving three of the five break points he faced in the third set.
"I have only myself to blame," said a disappointed Mayer.
"Roger wasn't in his best form. I let a great chance off the hook and was almost afraid of winning against a big name."
Federer has a 32-4 event record in Hamburg, where he won the title in 2002, 2004-05 and 2007, then finished runner-up in 2008 to Rafael Nadal.
The Swiss star will now face Argentinian qualifier Federico Delbonis in Saturday's semi-finals.
German second-seed Tommy Haas made a quarter-final exit when he lost in straight sets, 6-2, 6-4, to Italian 12th-seed Fabio Fognini, who claimed his first ATP tournament win at Stuttgart last week.
Fognini will play third-seed Spaniard Nicolas Almagro, who beat fifth-seed Juan Monaco of Argentina 4-6, 6-0, 6-3 in just under two hours.