Drama ensued in Mongomo as Asamoah Gyan's injury-time winner for Ghana saw off Algeria 1-0 in Africa Cup of Nations Group C.
Asamoah Gyan returned to breathe fresh life into Ghana's Africa Cup of Nations campaign as his injury-time winner sank Algeria 1-0 in Mongomo on Friday.
The Al Ain striker missed Ghana's opening Group C defeat to Senegal with a bout of malaria.
However, the former Sunderland man was the hero for Avram Grant's side as his composed finish in stoppage time earned a potentially crucial three points.
The first half proved a lacklustre affair with chances at a premium, although Nabil Bentaleb will feel he should have put Algeria - the highest ranked team in the tournament - into a first-half lead when he skewed wide from close range.
Ghana improved after the break, though, and Gyan flashed a header wide, before Andre Ayew nodded over the crossbar when free in the penalty area.
The Black Stars were rewarded for their improved showing with Gyan's late strike, and a win for Ghana leaves them and Algeria on three points, while Senegal can move to the brink of the last eight by beating South Africa in Group C's other clash later on Friday.
There were few clear-cut chances in a tepid opening, although Algeria's Faouzi Ghoulam chanced his arm with a fizzing 30-yard free-kick that went wide before a heavy touch from Ghana goalkeeper Brimah Razak almost gifted Yacine Brahimi an easy opening.
Saphir Taider was then perhaps lucky to go unpunished for an over-the-ball challenge on Andre Ayew.
Algeria continued to look more comfortable on the ball and they wasted a great chance to take the lead in the 20th minute.
Sofiane Feghouli's neat pass set Aissa Mandi free down the right and his cut-back picked out Bentaleb, who sliced his left-foot shot wide from eight yards.
Tempers threatened to boil over thanks to some poorly timed tackles and the two sides came together briefly when Bentaleb and Ishak Belfodil responded angrily to a hefty tackle from Emmanuel Agyemang-Badu.
Ghana had posed little threat going forward, but Madjid Bougherra was twice on hand to make decisive interceptions in the penalty area with Gyan lurking.
The Black Stars improved after the break and Gyan met Harrison Afful's cross from the right with a stooping header that trickled wide of the far post.
Grant's men continued in the ascendancy and Andre Ayew tormented Mandi on the left channel before his centre picked out his brother Jordan, whose nonchalant flick with his heel went just over the crossbar.
Algeria almost stole ahead on the counter-attack in the 66th minute when Brahimi's pass to the left of the box picked out Bentaleb and his guided shot flashed across the face of goal.
At the other end, Christian Atsu's pin-point cross picked out an unmarked Andre Ayew, but he headed over.
With the match seemingly heading for a stalemate, Ghana struck at the last when Gyan latched onto a long ball forward and his strike across goal got the better of Algeria goalkeeper Rais M'Bolhi and nestled in the bottom left-hand corner, much to the delight of the Ghana players.