Top seed Juan Martin Del Potro retained his Swiss Indoors title with a 7-6 (7-3) 2-6 6-4 victory against home favourite Roger Federer in Basel.
A sixth Swiss title for world number six Federer would have sealed his place at next month's ATP World Tour Finals in London for a 12th successive year.
"It's always a pleasure to play Roger. He's the hero here and for me my biggest inspiration," said Del Potro.
Federer said: "I fought hard all the way. I lifted my level but so did he."
Race to ATP Tour Finals
- 11,670 points (Q)
- 9,610 (Q)
(ruled out through injury)
- 5,200 (Q)
Juan Martin Del Potro
- 4,875 (Q)
- 3,800 (Q)
Richard Gasquet -
Standings correct as of Sunday, 27 October. Top eight qualify, (Q) denotes already qualified
The 32-year-old, who has won only one title in 2013, produced some vintage moments but could not deny Del Potro his fourth ATP Tour 500 title in a calendar year.
The Swiss now has to beat Kevin Anderson or Mikhail Youzhny in his second-round match at the final qualifying event in Paris next week to ensure one of the eight places at the 02 Arena for the World Tour Finals, which would equal Ivan Lendl for the most successive appearances at the season finale.
Del Potro, already safely through to the Tour Finals, broke in the eighth game of the opening set but to the delight of the crowd Federer broke back immediately to love.
The home favourite saved two break points to take the set to a tie-break but quickly found himself 3-0 down and Del Potro went on to take the set.
A majestic cross court winner sealed a break early in the second, however, and Federer swiftly claimed the set in 36 minutes.
But having saved one break point with an overhead volley at full stretch, Federer lost his serve in the opening game of the decider with a double fault.
He had two break points in the next but was unable to take them, and had to stave off a break point opportunity for Del Potro in the seventh game before the world number five comfortably served out for his third successive victory against the 17-time Grand Slam winner.
Federer, playing in his eighth consecutive Basel final and 10th overall at the stadium where he got his start in the game as a ballboy nearly two decades ago, has only beaten one top-10 opponent in 2013, the then number eight Jo-Wilfried Tsonga in the Australian Open quarter-finals.
He had been attempting to win his 78th career trophy from 113 finals and six or more titles at his fourth different tournament.