Substitute Vincent Aboubakar swept in the winner two minutes from time, flicking the ball over defender Ali Gabr and thumping it home.
Nicolas Nkoulou had earlier equalised for Cameroon, rising highest to power in a header on the hour mark.
The equaliser cancelled out Mohamed Elneny's opener on 22 minutes with a beautifully taken near-post strike.
The wild celebrations for Aboubakar's winner announced Cameroon's return to the continental summit, after a wait of 15 years.
It also makes them the second most successful nation in the competition's history - behind Egypt - and marks the first time they have beaten the Pharoahs in the final in three attempts.
Besiktas striker Aboubakar ran towards the triumphant Cameroon fans in the Stade de l'Amitie stands in Libreville to celebrate, pursued by delirious teammates and coaching staff.
Underdogs Cameroon had already upset the odds to reach the final and stunned the much-fancied Egyptians with the late dramatic strike, after fellow substitute Nkoulou had drawn them level.
Despite being beset by pre-tournament problems, including the withdrawal of key players such as Joel Matip and Eric Chuopo-Moting, coach Hugo Broos managed to assemble a squad that got their reward for being strong, adaptable and resilient in equal measure throughout.
The Pharaohs - bidding for an eighth title after seven years in the international wilderness - started comfortably and Elneny's opening strike capped a wonderful fluent move down the right.
The Gunners midfielder started the move and finished it, after receiving the ball from Mohamed Salah in the box and sweeping it past Fabrice Ondoa into the roof of the net at the near post.
Aboubakar controlled a long ball forward with his chest at the edge of the box, flicked it over the stranded Gabr, before gathering, taking a step and smashing home off his right foot for a fitting winner.
The Egyptians - featuring the tournament's oldest and most experienced player - El Hadary, were left stunned after looking comfortable for much of the first half.
As they had done for much of the tournament, Egypt relied on a well-marshalled defence, led by Ahmed Hegazy, Gabr and Hull City's Ahmed Elmohamady. They also had the formidable Elneny and Salah leading the line.
The Pharaohs more than played their part in an entertaining final, but it was Cameroon's energy that would light up the occasion and provide a thrilling end to a thoroughly entertaining tournament for the near-capacity crowd of more than 38,000 in the Gabonese capital.
Belgian coach Broos reflected the unity in his squad's ranks, as he celebrated the first Nations Cup title of his career.
"I am happy for the players," he said. "This is not a group of football players, they are a group of friends."
Egypt coach Hector Cuper was left to dwell on another defeat in a major final, having lost two European Champions League finals with Spanish club Valencia.
"The sadness I have is not because I lost another final," he said.
"It's because there was so much hope especially among the people in Egypt and I am sorry for the players who put in so much effort."