Instead, Federer forced a tie-break and a saved two more set points before triumphing 9-7 with 70 minutes gone.
There was an air of inevitability from that point on, Goffin having only beaten the all-time great once in his last 10 meetings, but once again the opportunity was there - the outcome might have been different had he converted more two of his five break-point opportunities.
Just one break of serve and one match point was all that the Swiss needed in the second set as he managed to get off court five minutes before the match clock hit two hours.
He will now play Alexander Zverev for a place in the semis after the fifth seed beat Russian Andrey Rublev 6-0 7-6(4), while Daniil Medvedev and Novak Djokovic are both potential opponents if Federer wants to seal a third Shanghai title.
In the top half of the draw, Djokovic needed just 76 minutes to complete his last-16 victory over John Isner as the big-hitting American failed to create a single break point opportunity.
The world No 1 will now face Stefanos Tsitsipas as he seeks to defend the title he beat Borna Coric to win 12 months ago.