Former Barcelona midfielder Keita, who had been the standout player in a scrappy match, was on hand to fire home after keeper Kassaly Daouda spilled the ball after coming to claim a cross.
Keita had been the biggest threat for Mali, forcing a couple of smart stops from Daouda and hitting the crossbar six minutes before he struck the winner.
Mali were comfortable favourites against their neighbours and, despite resting Momo Sissoko, Modibo Maiga and Samba Diakite, they started well.
Cheick Diabate twice stung the palms of Daouda, Sigamary Diarra fired over the bar and Mahamdou N’Diaye could only put his header wide from a corner.
But Niger gained in confidence as the half went on, with Mali keeper Mamadou Samassa forced into a fine double-save after a goalmouth scramble followed a corner.
Still, the possession and chances were falling to Mali, with Cheick Diarra missing a sitter, although admittedly the ball came to him at pace after Daouda flapped at a corner.
The half was nothing to write home about though, ending goalless albeit with Mali in the ascendance as Diabate and Diarra impressed going forward.
Mali were comfortably the dominant force in the second half as Diarra and substitute Mahamadou Samassa continued to threaten; Mahamadou Samassa fired one just wide and put another into the side netting, while Keita – who had grown into the game – forced an excellent save from Daouda.
Niger, meanwhile, were struggling to pass halfway, their best opportunity coming when Mohamed Traore gave the ball away, keeper Mamadou Samassa doing well to deny Modibo Sidibe.
A very scrappy phase followed, although the match sparked back into life with a quarter of an hour remaining.
It came from a rare Niger chance, with Moussa Maazou heading over after a towering leap, that incident seeming to re-awake Mali from their slumber.
The latter stages were all about the Malians, as Keita side-footed against the bar, while Mahamane Traore headed over from close range.
The breakthrough finally came on 84 minutes, and it was disastrous for poor Daouda, who had done well until he dropped a high ball under pressure from Diabate. Keita, with a trademark late run from midfield, was on hand to finish.
The final minutes saw Mali sit deep to close out the win, with Niger out of ideas and energy as the match fizzled out.
The 2-2 draw between Ghana and DR Congo means Mali go top for now, although they will have to play much better to beat that pair.