Ahmed Osman struck early in each half for the Libyans on a barely playable Estadio de Bata pitch, but his goals were cancelled out as Emmanuel Mayuka and captain Christopher Katongo netted.
The result means pre-tournament 125/1 rank outsiders and co-hosts Equatorial Guinea will become the first team to reach the quarter-finals if they defeat Senegal in the second half of a double-header.
Libya, whose players risked their lives to fulfill qualifying fixtures while a civil war raged in the north African country, retained a mathematical chance of making the last eight. The kick-off of the first second-round group fixture was delayed 76 minutes after torrential late-afternoon rain dotted the pitch at the 35,000-seat stadium with mini lakes.
Efforts to clear puddles of varying sizes included the use of brooms, long and short planks of wood and the belated appearance of a machine which sped up the process. However, there remained large areas of the pitch that were waterlogged.
Libya's Brazilian coach Marcos Paqueta said: "It was hard for both teams to play in these conditions. I think the result was deserved. We were up against a very good Zambia side, the group favourites. We still have a chance to qualify."
Libya's captain and goalkeeper Samir Abod added: "The conditions were very difficult, it was hard to control the ball. Given the state of the pitch the coach issued instructions based on playing the ball long."
Walid El Khatroushi, who quit football temporarily last year to fight for the rebels who toppled Moamer Kadhafi, created the fifth-minute opening goal with a slide rule pass and Osman beat onrushing goalkeeper Kennedy Mweene to score.
Forced to come off injured in the loss to Equatorial Guinea last weekend, midfielder El Khatroushi was out of luck again midway through the first half with Ihab El Busaifi taking his place.
Fast-footed Zambia were not finding the heavy conditions to their liking against more direct opponents, but they gradually took command and it was no surprise when they levelled just before the half-hour mark.
Rainford Kalaba floated a superb cross to the far post where Mayuka hooked the ball across 39-year-old Libya captain Samir Abod into the far corner of the net. Osman struck again two minutes after half-time, showing excellent control inside the six-yard box to score with a shot that went in off the post after Zambia failed to clear a low El Busaifi cross.
No Zambian heads dropped, though, and they equalised again after 54 minutes when a cross and a bicycle-kick set up unmarked captain Katongo to nod home at the far post.