The world number nine's victory was all the more impressive considering his father had died earlier in the week and had missed the semi-final victory over Great Britain to attend the funeral.
The No. 15-ranked Shapovalov - Canada's top singles player - was competing in a must-win match after Montreal's Felix Auger-Aliassime dropped the opening singles rubber in straight sets to Roberto Bautista Agut.
With the clock ticking well past midnight yet again, the inspired British pair kept their noses in front on serve in the second set and when Lopez made a awful mess of a smash on the Nadal serve at 5-6 they had a set point.
Roberto Bautista Agut delivered a big blow to Canada's hopes of capturing its first Davis Cup title.
The Spanish crowd that packed the Caja Magica center court erupted when Nadal converted his third match point to clinch the title for Spain at the inaugural Davis Cup Finals with an insurmountable 2-0 lead. Canada first appeared in the global team tournament in 1913, is playing in its 10th final.
"[It was an] fantastic week", Nadal, who was also awarded the tournament MVP award, said.
Nadal and Feliciano Lopez defeated Jamie Murray and Neal Skupski, 7-6 (3), 7-6 (8) in the decisive doubles to secure Spain its first final since 2012.
The 20-year-old Shapovalov stunningly defeated Nadal in the round of 16 at the Rogers Cup in 2017 - his breakout season on Tour - in their first career meeting.
Kyle Edmund gave Britain the lead with a 6-3 7-6 (7-3) win over the 38-year-old Lopez before Nadal levelled things up with a dominant 6-4 6-0 display against Dan Evans - the Spaniard's 27th consecutive singles win in Davis Cup. This is because Spain have Rafael Nadal.
The Canadians team is competing in the final at a Davis Cup for the first time.
Ahead of the final, Nadal explained just how hard it has been this week for the Spain team.
Perhaps not surprisingly, Auger-Aliassime looked rusty, with his forehand breaking down far too often and double faults peppering his service games.
Neither Rublev nor Pospisil had lost a singles match, the latter despite being ranked 150, but it was the Russian who kept his record intact with a 6-4 6-4 victory.
"Rafa Rafa" the crowd bellowed as they saluted their hero and he will need them behind him again in Sunday's climax against Canada at the end of an exhausting week. The new event was created to make the team competition more attractive and lucrative.
Pospisil and Shapovalov have played all of the matches for Canada, which won Group F by defeating former champions Italy and the United States, then eliminated another former champ Australia in the quarterfinals.
Clearly, the players still care about the Davis Cup, even in its new incarnation, and not just because of the $18m that is being shared out between them in prizemoney.
Canada guaranteed its spot in the Davis Cup Finals tournament in 2020 by reaching the semi-finals this year.