Nigeria and Libya booked their places in the last four of the 2018 African Nations Championship on Sunday, eliminating Angola and Congo, respectively, in Morocco.
The Super Eagles will now face Sudan in the semi-finals, as Libya play the tournament hosts for a place in the 2018 CHAN final.
The Nigerians faced elimination after trailing 1-0 in the second half, but a 92nd-minute equaliser by Anthony Okpotu took the game into extra-time.
Okechukwu Gabriel was the hero for Nigeria as he grabbed the winner after 109 minutes of play.
Libya had to endure a penalty shootout in their clash with Congo, prevailing 5-3 in a dramatic finale as the game ended 1-1 after extra time.
Here are Sunday's results and confirmed semi-final lineup:
Nigeria 2-1 Angola
Congo 1-1 Libya (Libya win 5-3 on penalties)
Semi-Finals: Wednesday, Jan. 31
Morocco vs. Libya
Sudan vs. Nigeria
Nigeria were forced to dig deep to maintain their aspirations at CHAN 2018, and they found the magic formula when hope appeared to be over.
Okpotu stunned Angola as the referee prepared to blow the final whistle, and they never recovered from the shock in extra time.
Va deflected the ball over the line for Angola after 55 minutes, and they appeared good for their lead as the Super Eagles coughed and spluttered.
The Nigerians hit the woodwork in the second half as they scrambled for an equaliser, but it seemed they would be departing the competition as the 90 minutes were up.
However, Okpotu was in the right place at the right time as the ball fell to his feet in the final seconds, and the player sparked scenes of rapture as he poked the ball over the goal line.
Gabriel had missed a number of chances in normal time, but he displayed composure to fire home and give his team the victory they craved.
CAF provided pictures from the game:
Libya had to battle against Congo in their quarter-final match, but the Mediterranean Knights were victorious in a penalty shootout.
Saleh Taher gave the Libyans an early advantage in the first half, but Junior Makiesse scored the equaliser for Congo after 32 minutes.
The second half was a stalemate, leading to extra time, but neither side would concede any ground as the match reached its conclusion.
Libya held their nerve in the shootout despite Congo's superiority in attack, and they finished their five penalties with aplomb to capture a 5-3 victory—with Sand Masaud hitting the final spot-kick.