Egypt will meet Cameroon in the final after stunning tournament favourites Ivory Coast in an engrossing contest.
Amr Zaki has scored four goals in tournament
Ahmed Fathi put the defending champions ahead on 12 minutes with a strike from the edge of the penalty area.
Amr Zaki made it 2-0 with a header after the break, but Kader Keita pulled a goal back a minute later with a stunning 25-yard strike.
Zaki scored another from the edge of the area, and Mohamed Aboutrika added the fourth in stoppage time.
Earlier Cameroon, who lost 4-2 to Egypt in their opening group game, beat Ghana 1-0.
Egypt goalkeeper Essam Al-Hadari had a superb game and he made at least two world-class saves at key moments of the game to keep his side ahead.
In contrast the Ivory Coast goalkeeper Boubacar Barry had to be substituted in the first half due to injury and his replacement, the inexperienced goalkeeper Stephan Loboue, looked at fault for Egypt's second and third goals.
Kolo Toure returned to the Ivory Coast defence, but was not at his sharpest, and he too was badly at fault for Egypt's third goal.
Egypt took a more physical approach to the game than usual, deciding to take on the Elephants' power.
Didier Drogba worked his way into the penalty area in the 11th minute, but goalkeeper Al-Hadari had the shot covered.
The Pharoahs went ahead a minute later when a corner was not cleared decisively and after the ball came to Fathi he fired it in at the near post.
Al-Hadari used his body to save a Drogba shot from six yards out, then at the other end, a 20-yard left-footer from Mohamed Aboutrika went narrowly wide.
Egypt continued to maintain their presence in the game with confident, incisive play, and there was a blow for Ivory Coast in the 37th minute.
Barry had to be replaced with Loboue, playing his first competitive international, having not featured for his German second division club all season.
But the Elephants were unlucky not to equalise in first-half stoppage time.
Drogba headed a corner goalwards with astonishing power, but the ball went straight into Al-Hadari's body, and, with Aruna Dindane ready to pounce, it was cleared away by Hosni Abd Rabou.
Al-Hadari stopped another Drogba header with a brilliant fingertip save three minutes into the second half.
The Ivory Coast pressure intensified and on the hour Al-Hadari had to punch Arthur Boka's inswinging free-kick over bar.
Zaki made it 2-0 in the 62nd minute after Ahmed Hassan swung in a corner that Didier Zokora tried to clear at the near post.
The ball went to Zaki, who headed in off the crossbar with Loboue not moving an inch.
Ivory Coast responded seconds later, when Keita was given room to dribble across to a central position and he unleashed a thunderbolt from 25 yards.
Zaki restored the two-goal advantage after Toure fatally turned his back on the ball allowing the striker to scored from 20 yards.
Ivory Coast applied continual pressure but Egypt held firm, and with the Elephants committed to attack, Aboutrika scored in stoppage time from an Egypt break.
Few would have predicted the scoreline, and the Pharaohs' defence of the trophy remains on course.
Ivory Coast: Barry (Loboue 37), Boka, Toure, Eboue, Meite, Toure Yaya, Zokora, Kalou (Bakari Kone 60), Drogba, Dindane (Arouna Kone 79), Keita.
Subs Not Used: Tiassa Kone, Djakpa, Fae, Gervinho, Gohouri, Romaric, Sanogo, Tiene, Zoro.
Goals: Keita 63.
Egypt: El Hadari, Mohamed, Hany Said, Fathi, Hassan, Moawad (Fathallah 77), Gomaa, Abd Rabou, Aboutriaka, Moteab (Zidan 69), Zaki (Ibrahim Said 86).
Subs Not Used: Sobhy, Abdel Monssef, El Mohamady, El Saeed, Fadl, Gamal, Mostafa, Shaaban, Shawky.
Goals: Fathi 12, Zaki 62, 67, Aboutriaka 90.
Ref: Eddy Maillet (Seychelles).