Berdych had entered the contest without dropping a set in this year's tournament but that statistic lasted only 39 minutes against the world's best player.
An outstretched Berdych scooped the ball into the net to drop his serve in the fourth game of the match and Federer maintained the advantage to win the first set.
With grey clouds hovering over centre court, the top seed conjured up a delightful lob that fell millimetres inside the baseline to break Berdych again for a 3-2 lead in the second set.
A wild backhand from the Czech gave Federer the second set and despite dropping his serve for the first time in the contest in the opening game of the third, the Swiss rallied to seal the match when Berdych struck a forehand error.
Federer will next meet Croatian 12th seed Mario Ancic.