(CNN) -- Mali beat Botswana 2-1 Wednesday to qualify for the Africa Cup of Nations quarterfinals from Group D of the competition. Goals from Garra Dembele and Barcelona star Seydou Keita with the winner secured the runners-up spot from the group behind Ghana, who were held 1-1 by Guinea in a match played at the same time in Franceville. It earned Mali, reaching this stage for the first time in eight years, a match against their coach Alain Giresse's former team, co-hosts Gabon. Botswana opened the scoring in Libreville six minutes into the second half with Moemedi Moatlaping converting after a fine move.
@highlight
Mali secures second qualifying spot from Group D of Africa Cup of Nations
@highlight
Mali reaches quarterfinals after beating Botswana 2-1 in Libreville
@highlight
Barcelona star Seydou Keita scores winner for Mali
@highlight
Ghana top group after being held 1-1 by Guinea
The @placeholder players had to wait until the Ghana-Guinea game had finished to make sure they went through, at the result celebrating wildly their passage to the last eight.