The Confederation of African Football CAF's executive committee, meeting in Cairo on Wednesday, ratified an agreement between Libya and South Africa to swap the tournaments previously awarded to them, African football's governing body said in a statement.
Libya will host the finals in 2017 and South Africa steps in with just 15 months' notice to take over the 2013 event.
The South African Football Association prematurely broke news of the agreement last month and was swiftly admonished for a breach of protocol before the CAF executive could rubber stamp the deal.
A South African delegation travelled to Cairo at the weekend to successfully smooth the situation over.
The next Nations Cup finals will be co-hosted by Equatorial Guinea and Gabon in January and February after which the tournament switches to every odd year.
Morocco will be the host in 2015.