Egypt came into the match with a 1-0 aggregate lead after the first leg, but it was all square minutes after kickoff when Hamdi Fathi's own goal after a poor clearance gave Senegal an early second-leg lead.
The hosts were by far the better side in the first half in front of a raucous crowd of 50,000 at the new Diamniadio Olympic Stadium outside of Dakar, but they could not find another goal and settled for a 1-0 advantage at the break.
Senegal controlled most exchanges either side of half-time although the game was often interrupted by niggly fouls, gamesmanship and occasional pushing and shoving between the anxious players.
It did not help that both coaches -- Aliou Cisse for Senegal and Carlos Queiroz for Egypt -- spent much of the match barking at the officials from the touchline.
Egypt substitute Zizo had two glorious chances to give his team the lead after coming on in the 70th minute, but the Zamalek attacker lacked a cutting edge and both opportunities went begging as the match crept toward extra time.
It was then Senegal's turn to waste a gilt-edged chance as Ismaila Sarr's curling shot missed wide of the far post after he found himself free on goal with only the Egypt keeper Mohamed El-Shenawy to beat.
Sarr missed another shocker early in extra time, with his close-range shot from a Sadio Mane cross going right at El-Shenawy with the goal otherwise wide open.
Senegal continued their dominance throughout extra time, but had nothing to show for it and the game went to a shootout.
In the shootout, the first four penalties were wasted before Sarr put Senegal ahead and Bamba Dieng made it 2-1 before Edouard Mendy saved from Mostafa Mohamed. Mane hit the decisive spot kick as the hosts prevailed to book a spot at the World Cup for the third time in the country's history.
"I was not worried about how they'll manage the game mentally. We have guys who have won the Champions League," said winning coach Cisse.
Mane's Liverpool teammate Mohamed Salah missed the opening spot kick for Egypt on Tuesday in a rematch of this year's Africa Cup of Nations final, which Senegal won 4-2 in an equally dramatic shootout.