Federer reached the US Open semi-finals by defeating Söderling 6-0, 6-3, 6-7 (6/8), 7-6 (8/6), but the Swede made him scrap for it after a dismal start.
It will be a record 22nd consecutive appearance in a Grand Slam semi-final for the Swiss star who is also bidding to win a record-equalling sixth straight US Open title.
Federer will play Serbian fourth seed Novak Djokovic for a place in Sunday’s final and the chance to win a 16th Grand Slam title, two more than all-time second best Pete Sampras.
“It was so close towards the end and it’s a great relief to come through because he played better and better as the game went on,” he said.
“It was too easy at the start, but he battled his way back into it and showed what a great player he is.
“It was cool when it started and being from Switzerland that was OK with me, but then it got cooler and him being from Sweden that was in his favour.”
Söderling had two break points on Federer’s opening serve but after failing to convert either of those, he was simply blown away by the artistry and power of the Swiss star’s game.
The first set was wrapped up in just 26 minutes with Söderling left shaking his head at his own inability to do anything about stopping the onslaught.
Söderling , who lost to Federer in the French Open final after pulling off the upset of the year by ending Rafael Nadal’s reign at Roland Garros, finally opened his account by holding serve to draw level 1-1 in the second set.
The big Swede stayed with Federer until 2-2, but then dropped serve for a fourth time and Federer raced away to take the set 6-3 after a bout of racquet-smashing from his frustrated opponent.
The third set saw Söderling steady the sinking ship and he even had two break points to lead 4-2, but they both were rubbed out by big serves from Federer.
He did succeed in dragging Federer into a tie-break but fell quickly behind 4-0.
It looked all over, but with nothing to lose, and finally unleashing his big serves and forehands, Söderling clawed his way back into it from 2-5 down to force a fourth set by taking the tie-break 8-6.
It was just the second set Söderling had taken off Federer in 12 matches dating back to 2004.
There was just a hint of frustration from Federer over his inability to put Söderling away as the Swede stubbornly hung on to his serve in the fourth set to force a second tie-break.
Both men sent down some big serves and Söderling had a set point at 6-5 to force a fifth set, but hit a forehand long and wide.
Federer then took the final two points of the match to chalk up his 40th straight win at Flushing Meadows, including one walkover.
Turning to his semi-final against Djikovic, Federer said: “I’ve played him here the last couple of years, a final and a semi.
“It will be a tough match and I am looking forward to it.”