Federer triumphed 7-6, 6-4 in an entertaining match which lasted nearly two hours but eventually saw the Belgian knocked out of the Shanghai Masters before the quarter-final stage.
But Goffin spurned five separate set points in the opener before Federer triumphed 9-7 in the breaker and went on to seal a straight-sets victory.
'Looking very sharp!' - Federer helps Nadal with his suit at Laver Cup in 2019
“It was tough,” Federer said.
“He served for the set at 6-5. We both had chances but he probably had a few more I must admit.
“I had to play some very accurate shots and it went very close to the lines.
- Murray and Fognini's furious row 'continued in locker room' - report
- Federer beats Goffin to set up Zverev clash in Shangai
“They could easily have gone another way I know that.
“I was a bit fortunate to win that first set but I played okay and I fought extremely hard.
“Sometimes it falls your way. I have had a good season and served well at the end.
“The first set was certainly crucial to put me in the lead.”
Federer will now face Alexander Zverev for a place in the semi-finals after the German beat Andrey Rublev 6-0, 7-6.
On the other side of the draw, Novak Djokovic barely appeared to break sweat in his clash John Isner, the American failing to create a single break point opportunity, despite admitting he felt 'a little bit of a pain' in his troublesome elbow during one point.
However, the world No 1 played doubles later in the day with no ill effects - other than losing to all-British pair Jamie Murray and Neal Skupski.
But Djokovic was still pleased with the way he was able to deal with the Isner serve in his singles victory.
“It is always a big challenge returning the serve of Isner,” he said.
“He has got one of the biggest serves of all time and one of the tallest guys ever to play tennis.
“With that height the serve is a huge weapon and huge advantage.
“I managed to find a good position on the return at the end of the first set and beginning of the second.
“I won five games in a row and that was the key, obviously having a break each set.
“Then I kind of held my serve. I felt it was one of the best serving matches I’ve had.”
‘Keep the points under five shots!’ - The time Nadal coached Federer at Laver Cup
'Don't be scared!' - Federer coaches Tsitsipas at Laver Cup 2019