Tuning up for the defence of his Australian Open title, Djokovic helped Serbia recover from the loss of the first singles rubber, when Roberto Bautista Agut scored a 7-5 6-1 victory over Dusan Lajovic.
With the pressure growing late on Sunday evening in Sydney, Djokovic rose to the occasion against world No.1 Nadal and landed a 6-2 7-6 (7-4) success for a 29th win in the pair's 55-match career rivalry.
That meant the inaugural edition of this event would be decided on doubles, and while Djokovic returned after a brief break to partner Viktor Troicki for Serbia, Nadal was only a spectator.
Pablo Carreno Busta and Feliciano Lopez lined up for Spain, but it could not resist the Serbia pairing and fell 6-3 6-4, the match ending at 1:04am on Monday morning.
An emotional Djokovic said of Serbia's 2-1 triumph: "I'll remember this experience for the rest of my life as it is definitely one of the nicest moments in my career."
Nadal was as intense at courtside as he can be in match action, but he was also essentially powerless to influence the outcome as Davis Cup winner Spain fell short of what would have been a famous double.
Serbia, backed by a large contingent of its supporters roaring approval inside the Ken Rosewall Arena, moved one game away from the trophy after a strong service game from Troicki.
Lopez and Carreno Busta staved off the immediate threat, but there was never any doubting Djokovic would complete the job once he got ball in hand.
He served out to love, sank to the court, then embraced Troicki before being mobbed by the rest of the Serbia squad.
Djokovic hurled a racket into the crowd, caught by a thrilled female fan, before he and Troicki wrapped themselves in a Serbia flag.
Djokovic said: "I've been very fortunate and blessed to have an amazing career in the last 15 years, but playing for the team and playing for the country with some of my best friends for a long, long time, you just can't match that, that's too special."
Troicki explained teaming up with Djokovic had been a treat, saying: "I remember playing with him since we were nine, 10, and to share such a moment with him... I'll remember it for the rest of my life. It's unreal."