Malabo - Zambia snatched top spot in Group A with a 1-0 win over Equatorial Guinea in the African Cup of Nations on Sunday to join the co-host in the quarter-finals and end Libya's faint hopes of progressing.
Christopher Katongo scored in the 67th minute against already-qualified Equatorial Guinea, with the co-host having to settle for second and a likely meeting with cup favorite Ivory Coast in the last eight.
"Our strategy was to go into the second round," said Katongo, "Whoever we meet it's not our problem. We have to concentrate on our own tactics and what the coach wants us to do."
Libya exceeded expectations simply by qualifying for the tournament as civil war raged at home, and the surprise opening 1-0 loss to Equatorial Guinea proved crucial as the north Africans bowed out despite beating Senegal 2-1.
Senegal crashed to a third straight loss at the tournament and a humiliating end after being tipped as one of the contenders for the title.
"Maybe it's a surprise for some people but we came to finish first," said charismatic Zambia coach Herve Renard, who arrived at his post-match news conference wearing a Zambia scarf over his lucky white shirt despite the hot and humid weather. "Maybe it was a difficult target but the players respected everything perfectly today."
Equatorial Guinea was playing its first match at the 15 000-plus Nuevo Estadio de Malabo, a smaller venue than the 37 500 Estadio de Bata where the team played its first two games.
Police again mounted a tight security operation with dogs and riot officers with full body armor and shields on patrol while a helicopter flew over the stadium.
Fans began arriving a few hours before kickoff and the bottleneck caused by police only allowing entry through one gate meant thousands queued outside the stadium, with reports of tear gas being used at one stage to control the crowd - a repeat of scenes at the opening match in Bata.
Despite the tough police tactics, a festive atmosphere reigned inside the stadium where fans blew trumpets, wore masks and wigs in the national colors of Equatorial Guinea and waved giant inflatable hands in support of the team.
The atmosphere was dampened somewhat by Katongo's decisive strike, the Zambia captain skipping past two challenges on the edge of the box before firing a low shot into the corner past Equatorial Guinea 'keeper Emanuel-Danilo Clementino.
Missing the suspended Iban Iyanga and Laurence Doe and with David Alvarez rested on the bench, Equatorial Guinea struggled to make many scoring chances.
Ivan Bolado missed the home side's best opportunity when he found space in the box from Daniel Ekedo's pass in the 41st, but he failed to lift his shot over Kennedy Mweene in the Zambia goal.
"It's only one defeat. We have to correct the mistakes for the next match and see the future optimistically," said Equatorial Guinea coach Gilson Paulo.
Although Equatorial Guinea had already qualified, missing out on top spot in the group could be crucial as Ivory Coast's host of Premier League players are the most likely opponents in the quarterfinals.
In the other Group A match, Ihaab Boussefi's two goals weren't enough to send Libya through despite a 2-1 win over Senegal.
Boussefi struck in the fifth and 84th minutes to give Libya victory at Estadio de Bata, but Zambia's win - which was played at the same time - ended their hopes.
The striker's double did lift Libya to its first victory at the Cup of Nations in 30 years, however, and the country's first win at the tournament on foreign soil.
Deme Ndiaye equalised with a glancing header from a corner in the 11th for Senegal, which was playing for pride, in a frantic start.
Nonetheless, Senegal slumped to a third straight 2-1 loss, to exit the Cup of Nations without a point for the first time in its history.
It was the second first-round elimination for Senegal in its last two tournaments after also not making it out the group stage in 2008. It didn't qualify for the African Cup in 2010.