The Nigerien soldiers were on patrol on Tuesday when they came under attack by heavily armed assailants who then fled toward the border, according to the defense ministry.
The Islamic State West Africa Province on Thursday asserted that it carried out the ambush as well as another deadly attack earlier in the week on a prison, according to the SITE Intelligence Group.
The ambush took place near Mangaize, about 45 kilometers (27 miles) from Tongo Tongo, the site of the October 2017 attack in which American soldiers died.
The latest attack underscores the security challenges facing Niger, one of the world's poorest countries. It has faced a growing threat from Islamic extremism in recent years as jihadists have spilled across the border from Mali to the west and Nigeria to the south.
A regional counterterror force known as the G5 Sahel is aimed at containing the extremist threat but member nations have cited issues with insufficient funding.
The 2017 attack by more than 100 Islamic State group fighters, which also killed four soldiers from Niger, prompted a U.S. military investigation. A report found that "no single failure or deficiency was the sole reason" for what happened. The outnumbered soldiers had been searching for a high-level Islamic State group leader.
Associated Press writer Krista Larson in Dakar, Senegal contributed.
Follow Africa news at https://twitter.com/AP_Africa
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.