Nadal sealed the hosts' passage into the last eight at La Caja Magica with a 6-4 6-3 victory over Borna Gojo, the world number one's 26th consecutive singles win in the competition.
That gave Spain a 2-0 lead and ensured Croatia could not finish above Russia in Group B due to Andrey Rublev's defeat of Roberto Bautista Agut.
Bautista Agut earlier made amends for that loss by easing to a 6-1 6-3 thrashing of Nikola Mektic in the opening rubber on day three.
Germany made a dream start in Madrid, beating Argentina 3-0 with Philipp Kohlschreiber seeing off Guido Pella 1-6 6-3 6-4:
And Jan-Lennard Struff a 6-3 7-6 (10-8) victor over Diego Schwartzman:
Kevin Krawietz and Andreas Mies put the icing on the cake against Maximo Gonzalez and Leonardo Mayer by winning the longest Davis Cup tie-break – taking the final set 7-6 (20-18).
Germany, top of Group C, denied Argentina the chance to seal a spot in the quarter-finals.
Andy Murray marked his first Davis Cup appearance in over three years with a hard-fought 6-7 (7-9) 6-4 7-6 (7-5) win over Tallon Griekspoor in Great Britain's 2-1 Group E success over Netherlands.
Novak Djokovic eased past Yoshihito Nishioka 6-1 6-2 in Serbia's 3-0 triumph over Japan, while Australia progressed after beating Belgium 2-1 and United States edged Italy 2-1 in a clash between two nations already eliminated.