Spain's Rafael Nadal was close to defeat against arch-rival Roger Federer but he rallied in time to secure a 5-7, 6-4, 6-3 victory and advance to the semifinals of the Western & Southern Open in Cincinnati, Ohio.

Federer played his best tennis in several months Friday evening to push the Spaniard to the limit, grabbing a service break in the 11th game en route to a first-set victory.

Nadal lacked aggressiveness in the early going and the Swiss great took full advantage, using his lethal forehand to punish short balls.

More tentative play from the Spaniard cost him early in the second set as well, as Federer was able to work his way out of a 15-40 hole to remain on serve at 2-2.

But the turning point in the match came in the 10th game of the second set, when the world No. 3 finally found the range on his heavy ground strokes to get the long-sought break of serve and even the contest at a set apiece.

Federer appeared demoralized at the start of the third set, losing his serve in the second game and finding himself down 0-3.

The 32-year-old Swiss saved four match points in the final game, but Nadal finished off the contest with a forehand down-the-line winner.

Although the instant replay showed that the ball was out by the slimmest of margins, the line judge ruled it "in" and Federer did not challenge the call.

Nadal said afterward that he picked up his game late in the second set.

"I think my movement starts to be better, more intensity. I started to put more balls inside on the return, and I started to have more times control of the ball from the baseline with my forehand, something that didn't happen the first set and a half," Nadal was quoted as saying by the ATP World Tour's Web site.

"But the match was there. It was very close. He had a good chance in the second. I think I played a good few points in important moments."

Next up for Nadal in Saturday's second semifinal will be Czech Tomas Berdych, who upset world No. 2 Andy Murray 6-3, 6-4 on Friday.

The first semifinal will pit big-serving American John Isner, who stunned world No. 1 Novak Djokovic in three sets in the quarterfinals, against Argentina's Juan Martin del Potro.

The Cincinnati Masters is one of the biggest hard-court events on the ATP Tour calendar and a key tune-up for the U.S. Open, which gets underway later this month. 

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino