Del Potro, fresh from beating the Swiss in the Basel final a fortnight ago, claimed a 7-6 4-6 6-3 victory at the O2 Arena to guarantee himself one of the top two places in Group B with a 2-1 record, the same as defending champion Federer.
Federer, who had won 12 consecutive matches at the tournament since a semi-final defeat by Nikolay Davydenko in 2009, also finished group play 2-1 and had already qualified for the semis before walking on court.
The final day of round-robin action began with seven scenarios still possible in Group B, but a three-set win for world number seven Del Potro muddied the waters as the line-up for the semi-finals will not be known until after the evening match between David Ferrer and Janko Tipsarevic.
Victory for Tipsarevic would see Del Potro top the group while a win for Ferrer would mean three players are tied on two wins and in that case Federer would win Group B because of his superior sets percentage and Del Potro would be runner-up.
Spain's Ferrer had been relying on a Federer victory to keep his hopes of a semi-final place alive.
"I was actually thinking more about David than I was thinking about whether I play Andy (Murray) or Novak (Djokovic), to be honest," Federer, who will face Group A runner-up Murray providing Tipsarevic does not beat Ferrer, said.
"I really wanted to give him a chance and give myself the best possible preparation for the semis.
"I really hoped I could win. I'm more disappointed for him than about losing today, to be quite honest."
With world number one Djokovic also into the semi-finals having finished 3-0 in group play, the line-up for Sunday's semi-finals, however it falls, is mouthwatering.
"Now you have three big names in the semi-finals and one big guy," the 1.98m Del Potro told reporters after his second indoor victory over Federer in as many weeks.
Federer looked untroubled on his serve in the opening set against the 24-year-old but paid the price for failing to convert to break points that would have given him a 5-3 lead.
The 17-times grand slam champion then played an error-strewn tiebreak which Del Potro took 7-3.
Federer was immaculate in the second set, breaking to love in the opening game and dropping just five points on his own delivery as he set up a decider.
Just when it seemed a 13th consecutive victory was looming, however, Federer was broken out of the blue to trail 2-0 in the decider and Del Potro was rock solid thereafter.
"It's indoor tennis, he has a big serve and all those things. But still the surface plays somewhat slow so I expect myself to get more returns into play," Federer said of his toothless performance in the deciding set.
"But it's important to move on right now. Mentally, it's important to look ahead and rest because it's a quick turnaround till tomorrow."
Despite an impressive performance Del Potro played down his chances of landing his biggest title since winning the US Open in 2009, also against Federer.
"I don't know who is the favorite," Del Potro, a finalist here three years ago, said. "Djokovic, Murray or Federer can win the tournament. I can tell you I'm the number four for sure."
- Related links