While Novak Djokovic and Rafael Nadal had blamed the new blue-clay court for their early exits, Federer's biggest obstacle was to overcome an opponent who had beaten him in three of their previous five meetings.
"It is amazing to win here again," said Federer, who will overtake Nadal as the second-ranked player behind Djokovic. "It has been a tough tournament. Tough to move, but you've got to try to make the most of it. Here there was some good tennis and some bad tennis, but you see that in all tournaments."
Berdych hit 14 winners and made just two unforced errors in a dominant first set. However, Federer finally found his ground game and broke Berdych twice to even the score and force the third set, where he secured the victory after Berdych had saved three championship points.
The sixth-seeded Berdych jumped out to a 3-0 lead after hitting a crosscourt return to take Federer's first service game.
Federer, who won here in 2006 and 2009, saved two set points before Berdych clinched the first set with a big serve that the Swiss star could only knock back into the net.
Federer continued to struggle with his shotmaking, but the 16-time Grand Slam winner evened the match by breaking twice in the second set, including when Berdych hit a double fault on set point.
"It was a tough tournament and a brutal draw. Tomas played very well," Federer said. "I'm sure we will see each other many more times and they will be quality matches like this one."
Berdych, who had carried the initiative through most of the match, became erratic as the pressure grew in the decider.
Serving to send the match to a tiebreaker, he fell behind 0-40 and then rallied back to force deuce, only to hit long and then net his final volley to end the match in a little more than 2½ hours.
The former top-ranked Federer has not been higher than No. 3 since March 2011.
"I want to congratulate Roger. He showed that he is really the star," Berdych said.
Information from The Associated Press was used in this report.