Malaga will host a historic Davis Cup final as Spain's Rafa Nadal bids farewell to the game after 24 years as a professional.