Federer has ranked as world number one for a record four-and-a-half years
Roger Federer's reign as world number one is under serious threat after he lost to 16th seed Ivo Karlovic in the third round of the Cincinnati Masters.
The Swiss' 6-7 6-4 6-7 defeat by the big-serving Croatian means Rafael Nadal could become world number one should the Spaniard win the tournament.
Nadal, ranked second in the world, progressed to the quarter-finals with a 6-4 7-6 defeat of Tommy Haas.
"I know I'm in a good position. I don't think about it too much," said Nadal.
Federer has been ranked as the world's number one for a record 234 consecutive weeks but his second-round loss to France's Gilles Simon in Toronto last week meant that Nadal had a chance to overtake him coming into this week's Masters tournament.
Having beaten Federer at Wimbledon and Roland Garros, Nadal could lay claim to being the world's best player but he can make it official should he win Sunday's final.
Even if Nadal does not win in Cincinnati he can accumulate enough points over the forthcoming weeks to pass Federer, whose defeat to Karlovic was his 11th loss of the season and his first against his opponent in seven matches.
The Olympics in Beijing represent Federer's next taste of action and he could compete in China as the second seed after failing to get a grip of his opponent's serve with the Croat sending down 22 aces.
"It's not easy coming from slower conditions to fast ones," said Federer. "But I have played Ivo on all surfaces and he actually gets a greater play on the slower ones.
"But what are you going to do if he serves like that? Maybe if I got the first set I would be sitting here and it would be different, but that's not the case."
The key moment of the first tie-break came when Karlovic stopped mid-point to challenge a line call, with Hawk-Eye showing Federer had pushed his shot long.
That gave Karlovic set point on serve and the Croatian took full advantage to wrap up the tie-break 8-6.
I'm looking forward for the next two tournaments. Those are really the ones that can make this season from a good one to a great one again
Undeterred, Federer earned two break points in game three of the second set, and while Karlovic saved them both with aces, the Swiss then broke in game five to take the set 6-4.
Neither player could gain the upper hand in the third set and Karlovic claimed the first two points of the tie-break - the second of which came on Federer's serve - allowing him to carve out three match points.
And although the Croatian pushed the first two long, Federer then hit a long return of his own to lose it 7-5 and hand the match to Karlovic.
Federer refused to be downbeat even though his four-and-a-half-year reign as world number one seems to be coming to an end.
"This year was hard, I guess, with the start of the year. But nevertheless, I still think it's been a good year. I just hope I can show it now at the Olympics and the US Open," he said.
"I'm looking forward for the next two tournaments. Those are really the ones that can make this season from a good one to a great one again."