Kiefer, the only man to take a set off Federer at Wimbledon this year, had the world number one rattled but the Swiss dug deep to set up a match with Argentine David Nalbandian or Italian Davide Sanguinetti.
Top seed Federer recovered from a break down to win the first set but although Kiefer let slip a 3-0 lead in the second, the German snatched the tiebreak 7-3 to level the match.
Kiefer, the world number 38, had two break points at 3-3 in the third set but Federer saved them both, one with an exquisite backhand pass.
Federer then broke in the eighth game and held to win the third set.
An early break in the fourth set was enough to seal victory and extend his winning streak on hard courts to 32 matches.
More from rediff