Rafael Nadal and Roberto Bautista Agut sealed Spain's sixth Davis Cup triumph at the expense of Canada's young guns on an emotional at a raucous La Caja Magica.
Bautista Agut shed tears on court after beating 19 year-old Felix Auger-Aliassime 7-6 (7-3) 6-3 in the first rubber just three days after the death of his father.
The 31 year-old showed incredible character to return for the final and rose to the occasion with the backing of a partisan crowd in Madrid.
Nadal then took centre stage on a highly charged evening, defeating battling 20 year-old Denis Shapovalov 6-3 7-6 (9-7) to secure a first Davis Cup triumph in eight years for the host as Canada failed to spoil the party in its first final.
Victory for Nadal in his homeland meant there was no need to battle it out in a deciding doubles rubber and put the icing on the cake at the end of another glorious season, which saw him win two grand slams to take his incredible tally to 19.
The world number one served superbly from the start but had to bide his time to force a break.
Shapovalov fended off break points in each of his first two service games before his fellow left-hander took a 4-2 lead with a rasping cross-court inside-out forehand winner.
A fired-up Nadal hopped beyond the baseline in delight after a return from Shapovalov sailed long to end a first set in which the home favourite lost just three points behind his sensational serve.
Shapovalov found another level in the second set, showing his quality with searing winners off both wings, but Nadal roared after saving the first break points he faced before levelling at 3-3.
Nadal saved a set point in a tie-break that always looked to be on the cards and dropped to the court in delight after Shapovalov drilled a forehand wide to spark jubilant scenes.
Auger-Aliassime earlier made a mammoth 45 unforced errors as Bautista Agut's experience shone through, the world number nine raising the roof when he took the opening-set tie-break after his teenage opponent overcooked a couple of wild groundstrokes.
Bautista Agut continued to glide around the court with fluency and opened up a 3-0 lead in the second set, then went 4-2 up courtesy of another errant Auger-Aliassime forehand after he had got back on serve.
The composed Bautista Agut refused to allow Auger-Aliassime - who has been sidelined with an ankle injury - a way back and pointed to the sky after a hold to love made it 1-0 Spain.