DOHA, Qatar (AP) Defending champion Roger Federer was tested for the first time Thursday at the Qatar Open before defeating Andreas Seppi of Italy 6-3, 5-7, 6-4 to reach the semifinals.

The third-ranked Federer set up a rematch of last year's semifinal against Jo-Wilfried Tsonga, after the Frenchman cruised past unseeded Albert Ramos of Spain 6-2, 6-1.

Rafael Nadal also reached the semifinals, playing some of his best tennis this week in dispatching of Mikhail Youzhny 6-4, 6-4. In the final quarterfinal match, Gael Monfils meets Viktor Troicki.

The 30-year-old Federer is aiming for his fourth Doha title. He won his 20th straight match since his U.S. Open semifinal loss to Novak Djokovic.

I thought I started well. I was able to play aggressive, not giving too much rhythm. He was obviously missing more shots due to that,'' said Federer, who improved to 26-3 in Doha.I thought he was a better player in that second set and deserved that set, and then the third set was close.''

Federer, who had never dropped a set against Seppi in seven wins, took a 3-0 lead in just six minutes and appeared en route to an easy victory. But he unraveled in the second set, going down 5-1 after a string of unforced errors coupled with improved returns from the 38th-ranked Italian.

Federer came back to tie the set at 5-all but Seppi took the last two games, evening the match when the 16-time Grand Slam champion hit his return long.

I definitely think Seppi, he's a good return player,'' Federer said.When you give him too many second serves, he can take advantage of that.''

Federer recovered in the third, breaking Seppi to go up 2-1. He saved two break points to take control at 5-3 and closed out the match with a blistering forehand winner into the corner which Seppi couldn't reach.

The sixth-ranked Tsonga struggled to three-set wins in his first two matches.

However, he broke Ramos in the first game and was never seriously challenged. He broke again to go up 5-2, and took a 4-1 lead in the second set, repeatedly pumping his fists when he hit winners and dancing as he closed out the match in just over an hour.

I was very aggressive at the very beginning with my play, so I did well today,'' said Tsonga, who joked this week that he was normally adiesel engine'' who starts slowly.

Tsonga said he was pleased with his serving, winning 83 percent of the first-serve points.

Tsonga said he looked forward to a rematch with Federer, whom he lost to last year in straight sets. Federer was 6-2 in 2011 against Tsonga, but lost to him in five sets at Wimbledon.

It's (always) a pleasure and an honor to play against this guy,'' Tsonga said.When you beat him, you know you can do it and that's it. So of course when you are going on the court the next time, you are a bit more confident.

``But it's all the time difficult anyway to play against this guy because when he plays his best level, he's better than every player.''


Follow Michael Casey on Twitter at https://twitter.com/mcasey1