Egypt's Mohamed Salah missed his spot-kick in the penalty shoot-out, allowing Sadio Mane to score the winning goal.
In a repeat of February's Africa Cup of Nations final, Senegal were left jubilant at the final whistle after winning on penalties, with Egypt's players disconsolate and one of the world's best players left contemplating his absence from November.
The second leg of the play-off tie was played in the new 50,000-seater stadium of the hosts and ended in a tie after extra time.
The decisive spot-kick for the Nations Cup was scored by the Reds forward after Mendy saved Mostafa Mohamed's penalty.
The four players who missed the first four penalties of the shoot out were all directed at by green laser pointers.
Boulaye Dia was the scorer of the only goal in normal time - notching after just four minutes with a shot that hit the body of Pharaohs defender Hamdi Fathi.
The advantage is critical.
It is the second time in six weeks that Egypt has been beaten on penalties.
The final of the Africa Cup of Nations took place in February. Too many Egypt misses meant that their goal scoring icon, Salah, didn't get to take one.
They made sure that he went first and that they had an eye on securing a crucial early advantage, after the captain of the team hit the bar with the first attempt of the shoot-out.
As his shot sailed over the bar, he did worse, going nowhere near Mendy's goal.
As the match drew to an end, it was clear that the laser pointers being directed at players from both sides were having an effect.
Seny Dieng struck confidently to put the Teranga Lions ahead, but Mendy saved Egypt and gave them a crucial advantage.
It was one that he took full advantage of.
It was not obvious that the game would end on penalties.
In the same minute and also as an own goal, Dia's strike was an echo of the one that gave Egypt the advantage in the first leg in Cairo.
Egypt failed to properly defend a dangerous free kick, with a headed goal-line clearance only making it as far as Dia. The ball went under El Shenawy and into the Egypt goal as Dia went to strike.
The roof of the new home of the Senegalese was almost torn off due to the intense atmosphere created by the lack of a running track.
Egypt stuck to a game plan of maintaining a tight defence and breaking down any attack with heavy contestable challenges, while making the most of any contact with themselves.
Before things got as far as penalties, there were two great chances for Senegal.
He was put through on the last day of the year, but El Shenawy made himself big enough to make sure the effort didn't go in.
The second was even better, with the ball played into him with an open goal in front of him. But his connection was shaky and spun from his foot into the body of El Shenawy, who could not believe his luck.
Zizo was brought on by Egypt at 70 minutes and he perked the Pharaohs up with a couple of mazy runs that drew some panicked clearances. Even though Egypt played for the penalties, the presence of the laser pointers through the game could suggest that it would be more of a lottery than they usually are.