MADRID (AP) - Roger Federer rallied to beat Tomas Berdych 3-6, 7-5, 7-5 and win the Madrid Open for a third time on Sunday.
Earlier, Serena Williams overpowered the top-ranked Victoria Azarenka 6-1, 6-3 to win the women's final.
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 even 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 1/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.
In a matchup of two of the tour's heaviest hitters, Williams battered Azarenka around the court with her big serve and vicious return to take the first four games and never looked back.
Williams had 14 aces on her way to her 41st career title and second of the season as she remained unbeaten in her last 13 matches on clay.
The loss ended Azarenka's run of winning her last four tournaments.
"I can still do better," Williams said when asked if she had found her best form following her return from a lengthy absence due to illness in 2011.
"This is really good. I have been working hard. I had some tough battles and really unfortunate circumstances so I really love this."
Williams broke Azarenka's first service game when the Australian Open winner could only send her powerful return into the stands.
William's strong start left Azarenka shaken, and she hit three double faults to cede her serve again and trail 3-0.
Azarenka netted a forehand after Williams had fallen on the slick surface and left the entire court open. She then produced another double fault to cap a disastrous first set.
Williams kept the momentum going, hitting her fifth and sixth aces to hold to love at the start of the second set.
The 13-time Grand Slam winner sealed the victory in 1 hour, 4 minutes with her final ace.
"She was so much better than me today," Azarenka said. "I have to give her credit, she's been showing great tennis the whole week."
(Copyright 2012 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.)