Ronald Martinez, Getty Images
Ivo Karlovic of Croatia exults after a 6-7, 6-4, 6-7 win against Roger Federer of Switzerland.

MASON, Ohio — Roger Federer lost another match and, perhaps, his longtime grip on No. 1 as well.

The world's top-ranked player had another out-of-character setback on Thursday, a three-set loss to Ivo Karlovic that left the Croat exulting on his back and opened the way for Rafael Nadal to take over the No. 1 spot by winning the Cincinnati Masters championship.

Nadal stayed on course for the seismic shift by beating Tommy Haas 6-4, 7-6 (0) later Thursday, reaching the quarterfinals with his 31st consecutive win. Three more wins and the top spot in the world rankings belongs to him.

It's been a long time coming.

Federer has been ranked No. 1 since Feb. 2, 2004, a record of 235 consecutive weeks. He and Nadal have held the top two spots since July 25, 2005. They will swap if Nadal extends his run of five consecutive tournament titles.

Since his epic five-set loss to Nadal at Wimbledon, Federer has lost in the second round in Toronto and failed to make the quarterfinals in Cincinnati, where he won the title last year. The 26-year-old Swiss star has been struggling to regain his aura of domination since he started the year with mononucleosis.

Nadal has taken advantage by improving his hard-court game and surpassing Federer on the court if not in the rankings.

Earlier, a 19-year-old Latvian who tends to lose concentration during matches and is getting over a soccer injury — one of those teenager moments — upset the last remaining American in the draw. Ernests Gulbis took advantage of James Blake's erratic serve for a 6-4, 1-6, 6-3 victory, leaving the United States shut out of the quarterfinals for the first time in the tournament's history.

"Yeah, it's unfortunate," Blake said. "I don't think American tennis is troubled by any means. But the way it is right now, the best players in the world are from Switzerland and Spain."

Third-seeded Novak Djokovic also advanced to the quarterfinals, beating Andreas Seppi 6-1, 6-2 to set up a rematch with Gulbis. Djokovic beat the Latvian in three close sets during the quarterfinals of the French Open.

Carlos Moya beat fourth-seeded Nikolay Davydenko in the continuation of a second-round match halted by rain on Wednesday night. A few hours later, Moya beat Igor Andreev to reach the semifinals.

ROGERS CUP: At Montreal, top-ranked Ana Ivanovic was knocked out of the Rogers Cup on Thursday by Tamira Paszek, giving second-ranked Jelena Jankovic a chance to take over the top spot in women's tennis if she can reach the final of the tournament. Paszek, a 17-year-old Austrian ranked 94th in the world, won 6-2, 1-6, 6-2 over Ivanovic, who was playing with a sore right thumb. Jankovic, a Serbian compatriot of Ivanovic, advanced to the quarterfinals with a 6-3, 6-2 win over Stephanie Dubois, the last Canadian left in the tournament. Jankovic next will face 19-year-old Dominika Cibulkova, who upset 12th-seeded Nadia Petrova 7-6 (2), 6-2. Svetlana Kuznetsova defeated 15-year-old Michelle Larcher de Brito 7-5, 2-6, 6-4 to advance to the quarterfinals.