Top-ranked Nadal came from a set down to beat Australia’s Alex de Minaur 4-6 7-5 6-1 and give Spain an unassailable 2-0 lead over the hosts.
World number two Djokovic had earlier beaten US Open finalist Daniil Medvedev 6-1 5-7 6-4 as Serbia beat Russia 3-0.
Djokovic beat Nadal in straight sets in last year’s Australian Open final and leads their head-to-head 28-26.
He has also not lost to Nadal on a hard court since the 2013 US Open final.
The Australian Open – the first Grand Slam of the year – begins on 20 January, eight days after the ATP Cup finishes.
Nadal lost his quarter-final singles match to Belgium’s David Goffin and was punished for a slow start by De Minaur, who is at a career-high of 18th in the rankings.
However, as De Minaur tired, Nadal went up a level, racing to a 4-0 lead in the deciding set before serving out victory on his first attempt.
Roberto Bautistua Agut had given Spain a lead in the tie after breezing past Nick Kyrgios 6-1 6-4, before Feliciano Lopez and Pablo Carreno Busta won in the doubles.
“Novak likes to play here and Serbia has a great team and is playing very well,” Nadal said.
“But Roberto played an amazing match and we have a good team, so we are ready for it.”
Djokovic overcomes ‘most difficult challenge of year so far’
Djokovic has not lost a match at the event, although he has dropped sets in his past two matches against Medvedev and Canada’s Denis Shapovalov.
However, he was able to overcome the highly-rated Medvedev to seal Serbia’s place in the final after Dusan Lajovic had beaten world number 17 Karen Khachanov 7-5 7-6 (7-1).
Viktor Troicki and Nikola Cacic then made it a clean sweep in the doubles with a 6-4 7-6 (9-7) win over Teimuraz Gabashvili and Konstantin Kravchuk.
“Medvedev is one of the best players in the world and he showed today why,” Djokovic said after their rubber.
“This was the most difficult challenge I have had so far this year.”
The 16-time Grand Slam champion later withdrew from the ATP event in Adelaide, which begins on 12 January. The Australian Open – the first Grand Slam of the year – starts on 20 January.
The 24-nation event started with six groups of four teams, who each played three round-robin ties. The ties – comprising two singles matches and one doubles – are best of three.