Mali left it late by claimed a 2-1 victory over Mozambique to top their Group A at the 2014 African Nations Championship.
A penalty deep in injury-time from Idrissa Traore handed the Maliens a win they deserved on the balance of play, but looked as though would elude them.
Mozambique had taken the lead through Josemar just before halftime, before Ibourahima Sidibe deservedly equalised for the superior Maliens minutes after the restart.Mali will now stay in Cape Town to meet the runners-up in Group B in the first quarterfinal on Saturday.
After having a goal disallowed early on, their was momentary panic for Mali when Mozambique scored.
The ball was fed out to Josemar on the right of the penalty-box and he was left unmarked to blast the ball home.
But that advantage lasted just three minutes into the second half as Mali got the equaliser.
Sidibe was released into the box by Abdoulaye Sissoko and he skipped past two defenders before firing low past Soarito in the Mozambique goal.
As the seconds ebbed away, Traore was clattered in the box as he looked to latch onto a cross in the box and converted the penalty he had won to hand his side victory.