Gojo, sitting at 280 in the ATP rankings in contrast to world No 1 Nadal, put up a fight in the first set, but ultimately succumbed to the pressure put on him by the French Open champion in the ninth game and the veteran served it out to love.
The second set was an altogether more straightforward affair. Nadal got a break in the opening game and only dropped four points on his own serve before sealing victory with another break to love.
Djokovic helps Serbia to win over Austria; Spain and Italy win
"He played very well, very bravely, so I'm happy for the victory," Nadal told Eurosport after the match.
"It was difficult to play a match against him... I didn't know him, but he played well. It was a good victory and I'm happy to be in the quarter-finals.
"The start of yesterday was not perfect but here we are. We found a way to win the four matches in a row, so that puts us through to the quarters so we're very happy."
Nadal's victory followed that of Roberto Bautista Agut over Nikola Mektic in the tie's opening singles rubber.
Bautista Agut raced through the first set 6-1 at a canter and though he was made to work slightly harder to claimed the second set 6-3, he was still able to get the hosts off to a winning start in Madrid.
Nadal later returned to the court for doubles action alongside Marcel Granollers and defeated Ivan Dodig and Mate Pavic 6-3, 6-4.
Spain are the second team to reach the last eight, following Canada, who sealed their place in the knockout stages thanks to wins over Italy and USA in their first two matches.
Elsewhere in the evening's action, Nick Kyrgios produced a fine serving display to see off Steve Darcis in straight 6-2, 7-6(9).
Despite winning the first set in a straightforward manner, the Australian was under severe pressure in the second set, but his big serve got him out of trouble.
Though he missed two match points in the tie-break, he converted the third to see off a brave effort from the Belgian.
A good day then got better for the Australians, as Alex De Minaur followed up his compatriot's win with a 6-0, 7-6(4) victory over David Goffin.
The US failed to advance despite beating Italy 2-1 after a doubles match ended after 4am local time in Madrid, the second latest finish in tennis history.
Sam Querry and Jack Sock won the decisive doubles match 7-6, 6-7, 6-4 against Simeone Bolelli and Fabio Fognini. But it wasn't enough to send the Americans into the quarter-finals as one of the two-best second-place finishes from the six groups.
Earlier, Fabio Fognini had seen off USA's Riley Opelka in three sets in a must-win match for Italy, but Taylor Fritz levelled the series after beating Matteo Berrettini 5-7, 7-6, 6-2.
'The most important thing is health' - Nadal reacts to Alcaraz's positive Covid-19 test
Carlos Alcaraz: 'It has been an incredible year, full of new experiences' - Players’ Voice