Novak Djokovic ended Roger Federer's winning run at his home-town tournament to lift the Davidoff Swiss Indoors title in Basle.
The world number one went into the match looking to win a fourth consecutive title in front of his adoring fans, but Djokovic spoiled the party with a 6-4 4-6 6-2 victory.
The Serb has been forced to battle from behind during the tournament, but it was a different story as he let a second-set lead slip before pressing home his dominance in the decider.
Second seed Djokovic went into the match trailing 9-4 in head-to-head clashes - although he had won two of four meetings this year.
He needed all his fighting spirit to serve out the first set. In a game lasting an astonishing 24 minutes, the 22-year-old saved five break points before finally clinching the two points he needed.
Djokovic then broke at the start of the second set. But Federer, clearly desperate to give his fans something to cheer, hit back before breaking his opponent to level the match.
The Swiss took more than six weeks off before the tournament - and maybe that lack of sharpness cost him in the third set as Djokovic, the champion in Beijing last month, quickly opened up a 4-0 lead.
Federer had chances to get back into the match but could not take them, and it was Djokovic who was able to celebrate a fourth title of the year.
Djokovic felt that titanic game at the end of the first set was the key to his victory.
"I started feeling really tense,'' said the world number three.
"He had a lot of break points, and I had a lot of set points.
"It was funny for the crowd to guess who would win the game. I think it was the turning point - because once I won the set, I started to feel better and more confident.
"It is definitely a big achievement to beat Roger in his home city. He had a huge amount of pressure on him to win today.
"I hope the crowd enjoyed it; I think we played a great match. I am really, really satisfied with this week.
"Nothing is easy, believe me, against Roger. I knew he was going to try to come back at any time. Although I was two breaks up (in the third set), he had some break points - but I served well at the key moments.''
Federer insisted he was content with the week, despite losing his title, but felt he did not make the most of his openings in the final.
He said: "I missed too many chances throughout the match. Novak played well and made it tough for me to get chances - but when I had them, he also played well.
"I think I could have played a bit better from the baseline, a bit more aggressive(ly). I was maybe lacking a bit of timing on my backhand side, but it was still a good tournament for me.''