Rafael Nadal came from a set down to beat Alex de Minaur 4-6 7-5 6-1 and seal Spain's place in the ATP Cup final, where Novak Djokovic's Serbia await.