Mali will face the Ivory Coast in the semi-finals of the Africa Cup of Nations after a 5-4 win on penalties against Gabon.
Eric Mouloungui gave Gabon the lead early in the second half when he got on the end of a hopeful free kick.
They nearly held on for the win, but Cheick Diabate fired in five minutes from time after turning in the area.
Seydou Keita nearly grabbed a dramatic winner for Mali in the dying seconds of extra time, but the midfielder could only scoop his effort over the bar.
Gabon's Pierre-Emerick Aubameyang was the only person to miss their spot kick in the penalty shootout as Mali bookked their place in the last four.