Bata - Equatorial Guinea produced one of its most memorable victories on Wednesday by scoring late in stoppage time for a 2-1 win against Senegal that clinched a spot in the quarter-finals of the African Cup of Nations.
David Alvarez' long-range strike in the 94th minute sealed a surprising place in the knockout round for the unfancied co-host and eliminated a Senegal side rated among the pre-tournament favourites.
The late winner sparked jubilation at the 37 500-capacity Estadio de Bata, where fans invaded the pitch to join in the celebrations until riot police restored order.
Earlier, Zambia rallied twice in a 2-2 draw with Libya and needs just a draw to progress also from Group A.
The doubleheader was delayed for more than an hour following a tropical deluge that waterlogged the pitch.
Earlier during an eventful day at the African Cup, Morocco goalkeeper Issam Badda was diagnosed with a benign form of malaria and received a blood transfusion at a hospital in co-host Gabon.
Team doctor Hefti Abderrazak said Badda was released from the Libreville hospital following the transfusion and was recovering at the team hotel.
Morocco striker Marouane Chamakh was also recovering after picking up a stomach illness, though the Arsenal forward's illness was not related to malaria, Morocco team media officer Dounia Lahrech said in an email.
The storm that preceded the Group A matches later in the evening left pools of standing water that hampered attacking play, but was a good omen for Equatorial Guinea - a team nicknamed Nzalang Nacional, or "National Lightning."
By the end of the evening it was Senegal's hopes that were washed out as the traditional African powerhouse was eliminated with a game to spare.
Coach Amara Traore made changes and dropped captain Mamadou Niang and Moussa Sow to the bench as he sought improvement from the opening 2-1 loss to Zambia.
Papiss Cisse and Dame N'Doye started in attack with Demba Ba, but Senegal could find no way through the well-drilled Equatorial Guinea defense in the first half despite a good opportunity that Ba dragged wide in the 22nd.
The Newcastle striker was withdrawn in the 58th, again unable to reproduce the form that has brought him 15 goals in the Premier League so far this season.
The co-host was relying on the counterattacking style that produced a late winner against Libya and the tactic looked to be working to perfection as Alvarez curled a centre for Iban Iyanga to head in the opening goal in the 62nd minute.
Senegal's vaunted attack laboured to create openings on the slippery surface and Traore brought on Niang and Sow to chase the game.
Sow looked to have snatched a point when he hooked the ball into the net following some indecisive defending at a free kick in the 89th minute.
Despite the equaliser, Equatorial Guinea was still in a happy position at that point, tied atop the group standings with Zambia on four points.
Five minutes later, the happiness turned to ecstasy.
Alvarez collected the ball and unleashed a drive that flew past Bouna Coundoul in the Senegal goal to seal a victory that guaranteed the Nzalang Nacional a spot in the quarter-finals at its debut appearance in the African Cup.
The game was the biggest mismatch on paper in this year's tournament, as Senegal is ranked 108 spots higher than the co-host.
Earlier, Zambia edged closer to clinching a berth in the knockout round after rallying twice to draw 2-2 with Libya.
Ahmed Osman scored at the beginning of each half for Libya, side-footing into the net in the fifth minute and adding another from close range in the 47th.
Emmanuel Mayuka volleyed an equalizer in the 29th and Christopher Katongo headed Zambia level for the second time in the 54th.
The final group fixtures will be played on Sunday, when Equatorial Guinea plays Zambia and Libya faces Senegal.
A draw would give Equatorial Guinea top spot in the group and also guarantee qualification for Zambia. Libya must beat Senegal and hope Equatorial Guinea wins against Zambia to have any chance of progressing.