Egypt beat South Africa, the only other nation to bid, by 16 votes to one with one abstention at a Caf executive committee vote in Senegal.
Original host nation Cameroon was stripped of staging duties in November because of slow preparations.
Egypt has just six months to prepare for the expanded 24-team finals, which kick off in June.
It will be the fifth time Egypt, which won the tournament when it last hosted in 2006, has staged the tournament.
“I want to thank the (Caf) Executive Committee for the trust, and I thank the government for this support,” said Egypt FA (EFA) president Hany Abu Rida.
“We organised the tournament on 2006 and that make us against a challenge to make better and better, we are ready for this honour.”
“The guarantee from government helped us to win against South Africa and that will help us to make a good tournament,” added Ahmed Shobair, vice-president of Egypt’s FA.
“The fans will be back again in the stadiums, which will be full in the tournament I promise.”
Egypt will use eight stadiums during the tournament, hosting in five different cities: Alexandria, Ismailia, Port Said, Suez and the capital Cairo.
Caf had originally planned to name the new hosts on Wednesday 9 January.
Since stripping Cameroon of this year’s event, Caf has offered the country the chance to stage the finals in two years’ time, which has meant that the original hosts for both the 2021 and 2023 finals have been asked to delay their tournaments.
Ivory Coast, which was set to host the 2021, has protested against the decision at the Court of Arbitration for Sport.
Guinea’s football federation announced on Monday that it has agreed to move its staging of the Nations Cup from 2023 to 2025.
Tuesday’s announcement took place in the Senegalese capital Dakar, which will host Caf’s annual awards ceremony later in the day.
Egypt’s Mohamed Salah is looking to retain his title as he takes on Gabon’s Pierre-Emerick Aubameyang and Senegal’s Sadio Mane for the African Player of the Year award.