Seven soldiers were killed in combat while five others died in an accident while driving to reinforce the unit that had come under attack, the statement said.
The attack took place near the tri-border zone of Mali, Burkina Faso and Niger that has been the epicenter of Islamist insurgencies in the Sahel region in the last few years.
The defence ministry statement said around a hundred insurgents were killed and their motorbikes and arms were destroyed.
Niger is run by a military junta that seized power in a coup in July, partly out of discontent at the worsening security situation. Neighbouring Mali and Burkina Faso have each had two coups in the last three years.