Roger Federer has failed to qualify for Sunday's final of the World Tour Finals in London after losing to Nikolay Davydenko 6-2, 4-6, 7-5.
It was the Russian's first win over top-ranked Federer in 13 matches. However, the Swiss is assured of his position at the end of the year despite Saturday's upset.
Federer, who was broken three straight times in the first set, came within two points of winning while leading 5-4 in the third set. But sixth-seed Davydenko held on and then broke Federer to take a 6-5 lead before serving out the win.
Federer again struggled with his serve and his shot-making for much of the match, but he looked invincible while serving throughout the third set and held easily through 5-4.
And with Davydenko serving to stay in the match, Federer took a 30-0 lead when he returned an overhead smash from Davydenko by running across the court and jumping high to get his racket on the ball.
Davydenko was stunned by the acrobatic return, but he still won the next four points to hold serve.
Federer again didn't look like himself at the O2 Arena, often misplacing his usual dominating forehand and struggling to hold serve against a player he had never before lost to.
Federer lost the first set in each of his three Group A matches, but managed to beat Fernando Verdasco and Andy Murray before losing to Juan Martin Del Potro - the same man who beat Federer in the US Open final in September.
On Saturday, Federer was stellar in the opening two games, first holding at love with a pair of aces and then earning a pair of break points in the second game.
But Davydenko, showing nerves of steel, saved them both, and he then went on his streak of breaking Federer three straight times. The 15-time Grand Slam champion broke back once.
To start the second set, Federer slowed down his powerful serve, thereby raising his first-serve percentage, and held easily throughout.
However, he still showed his frustration early in the set.
After sending backhand return into the base of the net, the ball came bouncing back toward him and he kicked it over to the other side of the court. That, too, went wide.
But leading 5-4 in that second set, he managed to break Davydenko for the second time when the Russian sent a forehand wide on Federer's second break point.
Davydenko came into the match on Saturday afternoon after playing well into the night the day before, when he needed three sets to beat Robin Söderling.
Before that, Davydenko lost to Novak Djokovic in his opening match but then beat second-ranked Rafael Nadal.
swissinfo.ch with agencies
The ATP World Tour Finals is a tournament played at the end of each tennis season.
It involves the top eight players in the men's tennis world rankings.
Federer won the event four times: 2003 and 2004 in Houston as well as 2006 and 2007 in Shanghai.
Davydenko made it to the final last year where he lost to Serbia's Novak Djokovic.