Spain defeated first-time finalists Canada to become the inaugural champions at the new-look event and lift the trophy for the first time since 2011 and the sixth overall.
Nadal has been unbeatable this week and it was fitting that he clinched the trophy with a 6-3 7-6 (7) victory over Denis Shapovalov.
But the biggest cheers were reserved for Nadal’s team-mate Roberto Bautista Agut, who opened the final with a 7-6 (3) 6-3 win against Felix Auger-Aliassime just three days after the death of his father.
Nadal said: “It’s the perfect end of the season for all of us. We know how difficult it is to win this trophy and we know how difficult it’s going to be to keep winning in the future.
“We knew that we need to convert this opportunity. And we fought very hard. What Roberto did today is out of this planet, in my opinion.
“It’s been amazing, the whole week of course. When you finally win the title after all the things that we went through this week and playing at home, it’s something difficult to describe.
“It’s an amazing feeling and especially to share this great moment with all the people that supported us during the whole week. And with the rest of the team.
“We can’t thank enough all of them. Everybody here in Madrid, the organisation, everybody. Because it’s been an unforgettable week for all of us without a doubt.”
Having played in Spain’s first two ties, Bautista Agut rushed home on Thursday after his father Joaquin was taken seriously ill, with the Spanish federation announcing the same evening that he had died.
The world number nine returned to Madrid on Saturday and supported his team-mates from the stands for their tense semi-final victory over Great Britain.
He produced a remarkably composed performance to defeat Auger-Aliassime but the facade cracked moments later, with the 31-year-old holding his finger to the sky before breaking down in tears as he was cheered by the capacity crowd.
Bautista Agut, whose mother died suddenly last year, said: “It was very difficult. I was speaking with (captain) Sergi (Bruguera) and I took the decision to go home on Thursday morning, and I was back yesterday afternoon to support the team.
“I was trying to do everything. I had the opportunity to play today because all the team and all the players and the rest of the team did an unbelievable effort since the first day. It was an amazing feeling on the court today.”
Canada had used only two players in making it to their first final, Shapovalov and Vasek Pospisil performing heroics in singles and doubles.
But Pospisil looked exhausted against Russia in the semi-finals while their number two, 19-year-old Auger-Aliassime, was fully recovered from an ankle injury that had kept him sidelined for two months.
Captain Frank Dancevic did not want to discuss his decision afterwards, saying only: “It was my call in the end to do the substitution today. And I’ll just leave it at that.”
It was a hell of a stage for the teenager to make his return, especially given this was only his second Davis Cup tie.
He matched Bautista Agut in the opening set until the tie-break, where the 31-year-old, whose wedding was scheduled for next weekend, used his experience to tempt errors from the youngster.
Perhaps not surprisingly, Auger-Aliassime looked rusty, and his forehand and serve rather broke down in the second set.
Nadal has been in such tremendous form that it felt like the first rubber was a must-win for Canada, and so it proved, although Shapovalov produced an excellent performance, especially in the second set.
He saved two match points in the tie-break with forehand winners and had one chance to push it to a decider but Nadal was not to be denied an eighth win of the week across singles and doubles.
Shapovalov said: “I feel like we’ve come really far as a team, as a nation. And definitely we’re super proud. Obviously it sucks losing in the finals. But I’m super proud of everyone.”
This week has capped off a remarkable season for Canadian tennis, with 20-year-old Shapovalov and Auger-Aliassime making big strides and Bianca Andreescu winning the US Open.
Nadal added: “The Canadian team is amazing. They are amazing today and they’re going to be one of the teams that’s going to be almost unbeatable in the next couple of years.”