It took penalties to separate Libya and Congo-Brazzaville after their quarter-final at the African Nations Championship (CHAN) ended 1-1 after extra-time in Morocco.
Veteran Congo captain and keeper Barel Mouko, 38, missed his penalty to give the win to the Libyans.
Earlier in Agadir the two sides had swapped first-half goals as Saleh Taher gave Libya the lead while Junior Makiesse grabbed Congo’s equaliser.
The winners now have the tough task of facing hosts Morocco in Wednesday’s semi-final at the continental tournament for players based in their own domestic leagues, in Casablanca.
Libya had a stand-in coach for the game as assistant Serbian Darko Novic took charge on the touchline in the unexplained absence of head coach Omar Al-Maryami
The first goal of the match came after 15 minutes when Taher scored his third of the tournament to put the 2014 winners ahead as he reacted to a parry from veteran keeper Barel Mouko, who dived trying to clear a cross.
Then 10 minutes before the break Congo moved forward down the left and a ball swung in found Prestige Mboungou unmarked in the area his diving header across the six-yard box was met by Makiesse to score.
Makiesse looked to add to his tally 20 minutes after half-time with two efforts from outside the area that were both well saved by Libya keeper Muhammad Nashnoush.
With four minutes left of normal time, substitute Abdelsalam Alaqoub should have won it for Libya but the ball got away from him as he was through one-on-one with Mouko who had an easy shot to save.
Then in injury time Abdulrahman Khalifa broke into the area but, despite having the space, he put his shot well wide of the post.
Libya pushed forward into the first period of extra-time with Congo’s defence holding firm while the roles were reversed for the final 15 minutes.
With neither side able to find a way through the game was decided by spot kicks.
Libya scored all five of their efforts as Congo captain and keeper Mouko put his effort well over the bar to hand the victory the Libyans.