Rafael Nadal fought off a strong challenge from Tomas Berdych to finish the round robin phase 3-0 and win his group at the ATP World Tour Finals, allowing Stanislas Wawrinka to join him in the semifinals.

Nadal won 6-4, 1-6, 6-3 after losing his grip on the match in the second set, dropping his serve twice. The Spaniard had already qualified from Group A after winning his first two matches, clinching the year-end No. 1 ranking the process.

He only needed to claim a set against Berdych to clinch the group win but came back after his second-set slump to break in the eighth game of the decider after Berdych double-faulted twice.

Wawrinka beat David Ferrer 6-7 (3), 6-4, 6-1 in the early match but needed a Nadal win to progress.

"I wish him a good holiday and good luck for the Davis Cup," Nadal said of Berdych, who will be playing in next week's Davis Cup final between defending champion Czech Republic and Novak Djokovic's Serbia in Belgrade. "In the second set he played great, it was very difficult to stop him."

Nadal, who has now won his last 16 meetings with Berdych, got off to a strong start, losing just five points on his service in the first set. But Berdych built a 5-0 lead in the second after pushing Nadal around the court.

The decider was more tense until Berdych, who would have advanced to the semis with a win, made several unforced errors in the eighth game. Nadal then sealed the win with a forehand passing shot.

Against Ferrer, Wawrinka hit 35 winners, including 12 aces, to clinch his second win at the elite year-end tournament.

Defending champion Novak Djokovic has won Group B and the winner of Saturday's match between Juan Martin del Potro and Roger Federer will join him in the semifinals.

The upper hand

Serving hard and varying his play nicely, Wawrinka had the upper hand early on and broke for a 4-2 lead before comfortably holding serve in the next game. But the seventh-seeded debutant failed to build on the momentum and made three unforced errors when serving for the set, and Ferrer then used an aggressive net game to win four consecutive games, including one that lasted 14 minutes

The Spaniard's excellent spell abruptly ended in the next game when Wawrinka took his serve at love to force a tiebreaker.

Ferrer, the 2009 runner-up, jumped to a 4-0 lead before his opponent's 29th error of the match gave him three set points. Following another long exchange from the baseline, Wawrinka missed a forehand to lose the set.

Wawrinka looked frustrated but it was soon Ferrer's turn to wobble, with the third-seeded Spaniard making three unforced errors including his first double-fault of the match in the third game of the second set as he dropped serve and whacked his racket against the floor in anger. This time, Wawrinka held his serve to level the match.

Two unforced errors by Ferrer in the first game of the decider gave Wawrinka an early break, and the U.S. Open semifinalist hit three aces in the next game for a 2-0 lead. Wawrinka broke again for a 4-1 lead and closed out the match with a backhand after Ferrer misplayed an easy volley.