Badu belter seals top spot for Ghana
Midfielder Badu, 21, collected a corner just outside the penalty area, flicked the ball up with his left foot and then sent a dipping volley into the far corner with his right to give the Black Stars the point they needed.
African Footballer of the Year runner-up Keita's first goal of the tournament in the 75th minute gave Mali a 2-1 win over debutants Botswana, who at least kept the score respectable after losing 6-1 to Guinea in their previous match.
Ghana topped Group D with seven points, with Mali on six and Guinea with four. Botswana failed to get off the mark.
Both Ghana's game in Franceville and the Mali match in Libreville were played in near deserted stadiums, a problem which has plagued the tournament both in Gabon, where Wednesday's matches were played, and co-hosts Equatorial Guinea.
The tournament was hit by another case of indiscipline as Tunisian midfielder Adel Chedi walked out on his team after failing to get any playing time at the tournament.
Chedli had left the team in Franceville and was heading back to Tunisia, Tunisian media officer Zouhaier Ward said.
The French-born Chedli, one of two survivors from the squad that won the Nations Cup in 2004, was sent to the stands for Tuesday's 1-0 defeat by co-hosts Gabon after reacting angrily to being left out of the team for the game.
Chedli's departure, ahead of Tunisia's appearance in Sunday's quarter-final, follows the expulsion of Zambian Clifford Mulenga by his side for breaking a curfew and failing to apologise.
Ghana will face Tunisia in Sunday's quarter-final while Mali play Gabon in one of the most open and entertaining Nations Cup tournaments in years.
In the other matches on Saturday, Equatorial Guinea will meet Ivory Coast, the co-favourites alongside Ghana, and Zambia play Sudan.
Ghana had the run of the dice against Guinea, who were unlucky not to win the game and force a three-way tie with their opponents and Mali.
That would have forced organisers to bring the calculators out to determine the top two sides under the complicated head-to-head system.
Guinea had a penalty appeal turned down and goal ruled out for offside before Badu, part of Ghana's world under-20 championship winning team in 2009, produced his masterpiece.
Guinea levelled in first half stoppage-time with a fortuitous effort. Abdoul Razzagui Camara sent what appeared to be an intended cross over from the left but the ball flew over a bemused Ghana goalkeeper Adam Kwarasey and into the net, the first goal Ghana have conceded at the tournament.
Guinea continued to have the better of the game after the break but lost momentum when Mamadou Dioulde Bah was sent off in the 70th minute, receiving a second yellow card for a high tackle.
In Libreville, Botswana scored first against the run of play with a sweeping move out of their midfield, started and finished by Mogakolodi Ngele in the 51st minute.
But Mali's pressure paid off six minutes later with AbdouTraore turning the defence before providing a cross that Modibo Maiga forcefully headed goalward. Botswana goalkeeper Modiri Marumo could only parry it right to Garra Dembele who hammered home from close range.
Keita's goal was set up by his persistence on the edge of the penalty area as he probed an opening and then got a return pass from Cheick Tidiane Diabate to perfectly place the ball into the roof of the net.
Then there was the further agony for a full five minute wait until Guinea's failure to beat Ghana was confirmed.
The Mali players stood anxiously waiting, watching pictures on the big screen before erupting in celebration.