Nigeria will face Ghana in the Africa Cup of Nations semi-finals after they beat Zambia 5-4 in a penalty shootout.
Super Eagles keeper Vincent Enyeama saved Thomas Nyirenda's effort and then scored the winning kick himself.
Nigeria were reduced to 10-men in extra-time after Onyekachi Apam received his second yellow card.
James Chamanga had Zambia's best chance but he could not connect before half-time and Obafemi Martins shot over in the second minute of extra-time.
Zambia coach Herve Renard will be pleased his team managed to contain Nigeria, who were favourites before the game - but in truth it was a poor showing from Shaibu Amodu's side who were relieved to go through.
They will now face Ghana on Thursday in an all-west African clash with the chance to face the winner of Egypt and Algeria in the final on Sunday.
"I just thank god. It was a crazy game - a difficult one for us," said goalkeeper Enyeama after the game.
"They are a very good team - believe me, they have a great future."
The drama of the shootout was in stark contrast to game which dragged along from the first whistle. Had it not been for penalties, the two teams would surely have played all night.
Indeed, the most memorable development from the game may well be the emergence of Zambia's Emmanuel Mbola. The 16-year-old left-back put in a very strong performance which will certainly have caught the eye of some big clubs.
Nigeria were a shadow of their famously attacking selves - rarely penetrating the Zambian defence with any menace or even purpose. They didn't win a single corner until the 101st minute.
As the game headed to penalties, things went from bad to worse when Apam received his second yellow card.
But, by then, both teams seemed ready for spot-kicks anyway - and Zambia didn't take advantage of having the extra man.
Early on in the game it was Nigeria who dominated possession, but once the Zambians settled they were rarely second to the ball.
Everton striker Yakubu was strangely quiet for the Super Eagles, looking frustrated at not getting good service from midfield.
Zambia battled hard against a technically superior Nigeria team
An early half-chance for Nigeria came in the form of a well-struck shot from John Obi Mikel who managed to wrap his foot around a loose ball to force a good save from Kennedy Mweene.
Zambia may have been disappointed not to have gone into the break when Mbola's darting run and cross fell to Chamanga - but the striker could not direct it home from close range.
In the second half, chances were few and far between.
In the 66th minute, Zambia had a header from Hichani Himonde cleared off the line by defender Yusuf Mohammed.
Nigeria immediately went straight up the other end - Yakubu's poor touch preventing him from a good scoring opportunity. He was substituted soon after.
Extra-time and penalties loomed. Martins did well to turn and shoot a couple of minutes into the first half of extended play - but his strike went over the bar from just inside the penalty area.
William Njobvu fired in a right-footed shot in the 109th minute. Enyeama did well to dive and tip it over - although it looked to be clearing the crossbar anyway.
Spectators and players alike seemed pleased when penalties finally came.
For Zambia, Noah Chivuta, Christopher Katongo, Emmanuel Mayuka and goalkeeper Mweene all scored with well-hit penalties.
Nigeria responded in kind with a perfect five from Mikel, Martins, Victor Obinna, Osaze Odemwingie and Enyeama.
But it was Nyirenda's kick - Zambia's fourth - which brought the first and only miss. The player maybe lost his concentration when he had to replace the ball on the spot.
Although through, Amodu's team will have done little to silence the critical voices from within Nigeria about the state of the national team.
Renard, who says he wants to take on a top African team when his contract expires in July, will have impressed many in this competition.
Zambia: Mweene, Musonda, Sunzu, Himonde, Mbola, Christopher Katongo, Nyirenda, Njobvu (Clifford Mulenga 114), Felix Katongo (Chivuta 98), Chamanga (Mayuka 68), Jacob Mulenga.
Subs Not Used: Kalililo, Kasonde, Dennis Banda, Chansa, Mbesuma, Chintu, Kalaba, Singuluma, Jacob Banda.
Booked: Felix Katongo, Himonde, Musonda, Christopher Katongo.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.