Switzerland's Federer overtakes Rafael Nadal in the world rankings. He is up to second spot with Nadal dropping to third after his surprise 6-3 3-6 7-5 loss to Fernando Verdasco in the third round earlier in the week.
Federer is the first man to win a tournament on the controversial surface and joins Nadal on 20 gongs in the overall list of winners of Masters titles.
"Congratulations to Tomas. I'm sure me and Tomas will play each other many more times," said Federer. "Thanks to everyone who made this event so special for us.
"I'm really looking forward to coming back next year It feels amazing," Federer told spectators sweltering in the Madrid heat inside the Manolo Santana show court as his wife and twin daughters looked on.
"Look, it's been a tough tournament and tough to move but you just go on with it and try to make the best out of it," added the 30-year-old.
"There was some good tennis and there was some bad tennis as well, you see that in all the tournaments, but I thought the level of play under the circumstances was very good."
Djokovic and Nadal suggested they will not be back if the surface remains blue rather than its traditional red in a year's time.
The crowd at the final booed the tournament consultant and former Romanian tennis player Ion Tiriac, the man behind the controversial use of the blue clay. It has been argued that it is easier to see the balls for viewers on the blue clay.
As well as the trophy, Federer was also presented with a framed black and white suit from movie star Will Smith, who was in town to promote his new Men in Black movie.
Czech sixth seed Berdych - who ended Federer's dream of Olympic gold in Athens in 2004 and knocked him out of Wimbledon in the quarter-finals two years ago - made the stronger start and a break of the Federer serve in the second game was enough to settle an otherwise desperately tight first set.
The crowd sweltering in the Madrid heat tried their best to lift the hugely-popular Federer, champion in 2006 and 2009, and he responded with two breaks of serve in the second set that helped him level the match.
A couple of double faults from Berdych, who was bidding for a second career Masters triumph, put Federer 5-3 ahead in the decider, but the 16-times grand slam champion faltered when serving for the match.
However, with Berdych needing to hold to stay in contention at 6-5 down, Federer conjured another break, converting his fourth match point when Berdych netted a forehand.
- Related links