Roger Federer hadn't played since Saturday and the long layoff proved costly as the world's top-ranked player lost to Tomas Berdych 7-6 (1), 6-4, 3-6, 6-3 on Wednesday.

The sixth-seeded Berdych dispatched the 17-time Grand Slam champion for the fourth time in the past seven meetings between the two.

"I just didn't come up with the goods tonight," Federer said according to the Associated Press. "It was unfortunate."

Federer hadn't played since Saturday due to the withdrawal of Mardy Fish for health reasons. The two were scheduled to play on Monday.

Berdych used a strong forehand and a powerful serve to take the first set tiebreaker before opening the second set with a break of Federer's serve. He took the second set to go up 2-0, but he previously had blown a similar lead to Federer at the Australian Open in 2009.

Federer was much sharper in the third set, coming back from a 3-1 deficit by breaking Berdych to tie it at 3-3. He took the set after reeling off four games in a row and winning 19 of 24 points.

It was on serve at 2-2 in the fourth when Federer got Berdych on the ground after trying to change directions for a return. Berdych hit his hand on the hard-court but was able to recover from love-30 down to take the game for a crucial hold and a 3-2 lead.

Berdych broke Federer to go up 5-3 and held his own serve to bring up match point. He smashed a 124 mph ace past Federer to end the match.

"When you leave it a little bit on Roger's game, and he starts to go for it, it could be a really big problem," Berdych said according to the Associated Press. "So I was just trying to get it back, trying to get my rhythm back again, and to stay as close as possible. And finally it was the right moment, right tactics."

Federer was previously 23-0 under the lights at Arthur Ashe Stadium and hadn't lost before the semifinals at the tournament since 2003.

The No. 1-ranked player had trouble with his serve throughout the night, giving Berdych numerous breaks, and also had 40 unforced errors. In three previous matches at the U.S. Open, Federer hadn't been broken on his serve once.

Berdych had 14 aces and 30 winners on the night and had half as many unforced errors as Federer, with 21.

Federer won the U.S. Open from 2004 to 2008, but the streak was broken by Juan Martin del Potro in 2009.

Del Potro advanced to the quarterfinals this year by beating Andy Roddick on Wednesday and will play defending champion Novak Djokovic.

Berdych will take on Murray Saturday in the semifinals.