Amr Zaki gave the Pharaohs an early lead but Algeria were still on the verge of booking a place at next year's South Africa finals due to better goal difference.
But Ahli striker Meteb, who replaced Zaki in the second half, broke Algeria hearts with a superb header five minutes into injury time.
It was his first competitive match with the national team after recovering from a six-month injury layoff.
Egypt and Algeria finished level on 13 points, goal difference, goals scored and head-to-head record to set up a playoff meeting in Sudan on Wednesday.
Sudan's Al-Merreikh Stadium in Omdurman, which was chosen by Egypt and confirmed by world governing body FIFA after a draw between it and Algeria's preferred venue in Tunisia, could host up to 40,000 spectators.
Egypt are bidding to reach the World Cup for the first time since 1990.
Early Goal
Influential midfielder Hosni Abd-Rabou started on the bench despite shaking off an ankle injury, making way for Mohamed Hommos who partnered skipper Ahmed Hassan in the heart of Egypt's midfield.
Calls for an early goal to mount psychological pressure on Algeria were very common before the game and the hosts achieved that aim, with Zaki finding the net after two minutes to send the home fans, who packed the 74,100-seat Cairo Stadium, into ecstasy.
Mohamed Abou-Treika's initial shot, after a cross from central defender Abdul-Zaher Al-Saqqa, struck the post in a box filled with several Egyptian forwards.
The ball then fell to Mohamed Zidan, whose low shot was parried by Algeria keeper Lounes Gaouaoui but Zaki reacted quickest and made no mistake from the follow-up.
Egypt could have added a second just eight minutes later when Abou-Treika's low free-kick took a deflection and hit the post but this time none of the team's forwards capitalized on the rebound.
They eased off a bit afterwards to allow Algeria to adopt a more courageous approach.
The visitors excelled in aerial challenges that could have gifted them the equalizer on two occasions, with the second one coming just before the break when Egypt keeper Essam Al-Hadari blocked a close-range header from the unmarked Antar Yahia.
Meteb Stunner
Algeria had a golden opportunity to stun Egypt early in the second half when a slip from sweeper Hani Saied gave Rafik Saifi the chance to latch onto a long ball and break clear of defense.
The 34-year-old, who plays for Qatari side Al-Khor, tried to loop Al-Hadari but the veteran guardian produced a superb reflex save to tip the ball over.
Algeria closed down spaces to make it difficult for Egypt to break down their resolute defense.
Coach Hassan Shehata introduced mercurial midfielder Mohamed Barakat, playmaker Ahmed Eid and Meteb in a bid to pile on pressure.
Egypt consequently upped the tempo and had a towering header by right winger Ahmed Al-Muhammadi palmed away by Gaouaoui.
With the final whistle approaching and Algeria players wasting time to claim a place at the World Cup for the first time since 1986, Meteb rose to head a pinpoint cross from Sayed Moawad past the hapless keeper.
Barakat almost handed Egypt a remarkable win just before the end but his close-range effort was thwarted by Gaouaoui.