Rescue teams found the bodies, along with 10 survivors and “significant material damage,” at the military post in Indelimane, in the country’s north-east, on Friday, government spokesman Yaya Sangare said in a statement.
The situation is now under control and the bodies are being identified, Sangare added.
The government called the assault a terrorist attack and urged the nation “to succeed in the war for freedom, peace and social cohesion in our country.”
No group has so far claimed responsibility for the assault.
The attack is one of the deadliest on military personnel in recent years. It follows separate attacks on army posts in central Mali in September that killed 38 soldiers.
A jihadist insurgency spread into the north and center of Mali in 2012, and foreign troops and the government have been unable to fully regain control of some regions of the landlocked West African country.
The European Union, which has been training Malian government forces in their fight against rebels in recent years, offered its condolences to the victims and relatives of those killed in Friday’s attack.
“The European Union stands by the government and the Malian nation to counter this serious violence,” it said in a statement.
“We continue to engage in support of Mali to allow the country to re-establish the full authority of the state over all its territory, to assure its development and the prosperity of its citizens.”