Serbia had fallen behind in the showpiece after Roberto Bautista-Agut defeated Dusan Lajovic 7-5, 6-1 but Djokovic levelled the tie in second singles rubber against Nadal before partnering Victor Troicki in the decider against Feliciano Lopez and Pablo Carreno Busta.
Djokovic made a fine start to the contest with Nadal, breaking in an elongated first game and leading for the remainder of the first set against an increasingly irate Nadal, who was seen remonstrating with the umpire then the crowd after being broken as the Serb took a 5-2 lead.
- Watch 2020 Australian Open LIVE on Eurosport: All you need to know
- Young guns set to shine at Adelaide as De Minaur tops seedings
'Just like old times' - Murray and Djokovic have fun-filled practice
Nadal regrouped in the second set but squandered his first break points of the match as Djokovic recovered from a 0-40 deficit to hold and make it 3-3.
The miss almost proved costly. Djokovic looked to have the match in the bag when he went 15-40 at 5-5 on the Nadal serve but the Spaniard summoned up two fantastic shots to stay in the contest, the first a volley which drew even the Serb's applause, the second a backhand down the line clocked at over 150 km/h.
When the set went to the eventual tiebreaker, a lax series of shots from Nadal gave Djokovic three match points, the first of which he converted as the US Open champion netted a forehand.
Nadal has now lost 19 straight sets on hard courts against Djokovic.
Nadal did not return for the doubles but Spain made a strong start in his absence, breaking Djokovic in the first game of the doubles rubber.
However, Serbia's class told and they mounted a fine comeback to win the first set 6-3 and after breaking in the first game of the second, Djokovic was on hand to serve it out and claim the inaugural title.
Fritz beats Evans to set up Djokovic clash, Sinner to face Nadal
Zverev downs Berrettini to clinch second Madrid crown