The Swiss seemed to spend most of the match fighting from behind but showed the grit of a true champion to topple the Argentine 4-6, 7-6(2), 7-5 at London's O2 Arena.
Victory meant he qualified for the last four as group runner-up to defending champion Novak Djokovic who will face Federer's fellow Swiss Stanislas Wawrinka in Sunday's other semi-final.
Federer had only once fallen in the round-robin phase of the season-ending tournament in 11 previous appearances and never since the tournament switched to London in 2009.
However, Del Potro looked favourite to tarnish that proud record as he moved a set and a break ahead.
Federer produced a stirring fightback from 5-1 down in the opening set only to fall short but hit back from a break in the second to level the contest with a commanding tiebreak.
The level of Federer's game fluctuated throughout the match and it dipped again at the start of the deciding set when a netted forehand gave the powerful Argentine a 2-0 lead.
Again Federer responded to a deficit with some of his most forceful tennis and Del Potro's erratic forehand gifted the six-times champion two cheap points in the fifth game to get the set back on serve.
With the crowd roaring on the six-times champion he broke Del Potro's serve to lead 6-5 and then completed his second victory over Del Potro in consecutive weeks with an ace.
Image: Roger Federer
Photograph: Eddie Keogh/Reuters
PHOTOS: No worries Wawrinka, it's Rafael to the rescue
Wawrinka outlasts Ferrer to keep hopes alive
Tour Finals: Djokovic fends off Del Potro, hope for Federer
World Tour finals: Federer keeps semis hopes alive with win over Gasquet
Djokovic douses Federer's fire, Nadal crushes Ferrer