Top-ranked Roger Federer has lost his hometown tournament, falling 6-4, 4-6, 6-2 to Novak Djokovic in the Swiss Indoors final on Sunday.

Djokovic earned his fourth title of the season with a victory that ended Federer’s run of three straight titles at the tournament.

The second-seeded Serb clinched the first set by saving five break points in a game that lasted 24 minutes.

“It was maybe the turning point in the whole match,” Djokovic said. “I was fortunate to keep my nerves.”

Federer fought back from a break down to win the second set and rouse his partisan fans.

Djokovic raced to a 4-0 lead in the decider, and closed out the victory after Federer wasted three break points in the sixth game.

Djokovic improved to 3-2 this year against Federer, and said the top-ranked Swiss pushed him to his limits.

“I have to produce something special to win,” Djokovic told the sold-out St. Jakobshalle crowd.

The first set went with serve, until Federer was broken for the first time in the tournament to trail 5-4. Then came a tense, error-strewn game that featured 11 deuces before Djokovic took his seventh set-point chance.

Federer dropped serve again to open the second set, sending another forehand into the net. But he won his next service game, and then broke his opponent for the first time when a drop shot grazed the net cord before falling in play.

He broke Djokovic’s serve again to win the set when the 22-year-old Serb sent a forehand into the net.

Djokovic rallied immediately in the decider, Federer dropping two straight service games for the second time in the match.

Trailing 4-1, Federer held three break points at 0-40 but was let down again by his groundstrokes as Djokovic reeled off five straight points. Djokovic needed just one match point to clinch, as Federer mistimed a backhand from the baseline.

More In: Tennis | Sport