BASEL, Switzerland (AP) -- Roger Federer is playing better tennis these days - just not quite good enough to win titles.
Juan Martin del Potro denied Federer his hometown Swiss Indoors title for the second straight year, winning the final 7-6 (3), 2-6, 6-4 on Sunday.
Federer reached his first final in more than four months and showed no sign of the back problems that hampered him during the most difficult season of his career.
''I am a winner, I don't take much confidence from losing matches,'' Federer said. ''I am happy about the level of my play, it's getting better, but it's not in losing where I get much confidence.''
Federer had hoped that the raucous crowd support in Basel - where he is a five-time champion - could help revive his form. He's won just one title in the past 14 months.
Del Potro beat the player he described as ''a big inspiration'' for the third straight time, including the 2012 Basel final.
''I think Roger is playing well,'' the fifth-ranked Argentine said. ''For me, he has the perfect game. He played much better when he has the chance to play the top guys.''
Still, Federer has only one victory against a top-10 opponent in 2013. That was back in January, against then-No. 8 Jo-Wilfried Tsonga in the Australian Open quarterfinals, before a series of defeats against opponents outside the top 50.
Federer can take one positive from his Swiss Indoors run, as it all but secured a place in the eight-man lineup at the ATP World Tour Finals in London starting on Nov. 4.
The sixth-ranked Swiss star would confirm his London place at the Paris Masters in midweek if he wins a second-round match against Kevin Anderson of South Africa or Mikhail Youzhny of Russia.
''Looking forward to Paris and London, he is going to be a really difficult opponent,'' del Potro said. ''Then he has the time for recovery to be ready for next season.''
The 32-year-old Federer still holds a 13-5 career record against the 25-year-old del Potro, but last beat him in the London Olympics semifinals at Wimbledon.
Del Potro earned his 17th career title and fourth this season. He also won at Rotterdam in February, Washington D.C. in August and Tokyo this month, all on his favored hard-court surface.
On Sunday, Federer lost the first set despite playing some of his best tennis this week.
After del Potro took a 5-3 lead with the first break, Federer responded with four straight points on his opponent's serve and shouted in triumph.
Facing two set points in the next game, Federer hit an ace and won a long, slugging rally that brought a yell of delight from the sold-out crowd of 9,200.
Still, del Potro dominated the tiebreaker helped by two net cords in his favor, and clinched the set when Federer sent a forehand wide.
Federer leveled the match with much less drama in the second set, after breaking to take a 2-0 lead with a forehand crosscourt winner. He broke again to clinch the set, set up by a pinpoint forehand winner, and got a standing ovation as he headed back to his seat.
''Roger started to play much better. In the finals, you can't relax in any moment,'' del Potro said.
Federer quickly wasted the advantage of serving first in the third, despite saving a break point with a leaping backhand overhead winner after del Potro's deft lob. He double-faulted to give del Potro a second opportunity and then hit a forehand long.
''I did hand the break over to him a little bit too easily in the third set, but I did well today,'' Federer said.
Serving for the match, del Potro hit an ace to set up three match points, and converted the second with strong ground strokes to move Federer around the court.
Del Potro improved to 48-13 this season and earned $480,000 for the victory.
Federer, now 40-14 in 2013, was playing his first final since winning the low-key grass-court event in June at Halle, Germany.
He remains tied with John McEnroe on 77 career singles titles, third most during the 45-year Open era. Jimmy Connors has 109 titles and Ivan Lendl has 94.
''He is also a better person than he is a tennis player,'' del Potro said of Federer. ''I am very proud to have a good relationship with him.''
Copyright 2014 Associated Press. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.