Federer, seeking a record 17th grand-slam title, will play either Argentine Juan Martin del Potro, the ninth seed, or number seven Tomas Berdych of Czech Republic in the last eight.
The Swiss, who won the Roland Garros title in 2009, saved two breakpoints before surrendering a third on a forehand error to lose the first set.
The 21-year-old Goffin, the first lucky loser to reach the last 16 of a grand slam since compatriot Dick Norman at Wimbledon in 1995, kept up the pressure but ultimately was no match for the wily Federer.
Goffin, who plastered his bedroom walls with posters of his idol Federer when he was a teenager, won over the fans on the windy Suzanne Lenglen Court with his fighting spirit and prowess at the net.
At a break down in the fourth set, and presumably feeling defeat's warm breath on his neck, Goffin won a point on Federer's serve with a particularly athletic volley.
The Belgian put his arm in the air, then graciously bowed to three sides of the court as the crowd cheered.
Federer, 30, held serve and served out for the match at the next opportunity, showing his younger rival how it was done with an ace and a spectacular forehand down the line on the final two points.
Goffin beamed. "It is really a dream to play against Roger and I hope to have many more matches like this," he said.
The two men embraced. The crowd cheered. Everyone went home happy.
Date: 03.06.2012, Source: Reuters