London, England, 11 November 2012 | AFP

Roger Federer will face Andy Murray and Novak Djokovic will take on Juan Martin del Potro in the semifinals of the ATP World Tour Finals after the last-four matches were finally settled following David Ferrer’s 4-6 6-3 6-1 win over Janko Tipsarevic on Saturday.

Both Ferrer and Tipsarevic were already eliminated from the season-ending event after del Potro’s surprise victory against Federer earlier on Saturday, but the result of their match was still significant as, due to the convoluted rules of the tournament, it would affect the semifinal match-ups.

In the end, Ferrer’s second win of the competition meant Federer topped Group B and will play US Open champion Murray, while del Potro finished second and goes up against Group A leader and world No.1 Djokovic, with both matches to be played on Sunday.

Argentina’s del Potro claimed a surprise 7-6(3) 4-6 6-3 victory over defending champion Federer on Saturday to book his semifinal spot, ending Federer’s 12-match winning run at the season-ending event.

Federer, who has won the World Tour Finals title for the past two years, already knew he was through after winning his first two group matches at London’s O2 Arena.

“I’m so happy to beat Roger once again, I know he’s a favourite here but the crowd respected me also,” del Potro said.

“I was a little lucky towards the end of the match. Always when you beat these kinds of players you need luck on your side but I played well.

“I took the break-point chances in the last set, then I served really well in the last game. I was very nervous but I closed out the match.

“It’s going to be a tough match against (Djokovic) but I’m so excited to get into the semis.”

Federer had won 13 of their previous 16 meetings, but the Argentine has given him plenty of trouble at times.

As well as winning his only grand slam title with a win over Federer at the 2009 US Open, del Potro also handed the 31-year-old his only other indoor defeat in the last two years in the final of his hometown tournament in Basel last month.

That pattern continued as a tight first set saw sixth-seeded del Potro save three break points to keep Federer at bay.

Then in the tie-break, Federer suddenly lost his rhythm and del Potro took advantage to snatch the first set.

Federer made a strong response, reeling off eight successive points to break at the start of the second set, and that was enough to level the match.

But del Potro’s big-hitting style blew Federer off course again in the deciding set.

The 17-time grand slam champion was unable to survive the barrage and del Potro broke for a 2-0 lead before holding his nerve to serve out a superb win in two hours.