The attack lasted several hours but was over by early evening, according to the spokesman, who wished to remain anonymous.
US General John Nicholson, commander of NATO's Resolute Support operation, said in a separate statement that the attack targeted "soldiers at prayer in a mosque and others in a dining facility" of the 209th Corps of the Afghan army.
The general, who did not give a toll, praised "the Afghan commandos who brought today's atrocity to an end".
"In total, there were 10 attackers involved in the attack on the Afghan army corps. Seven of them were killed, two blew themselves up, and one was detained by Afghan forces," Waziri told AFP.
Also Read
The Afghan general earlier gave a toll of eight soldiers killed and 11 wounded but said this would change.
Several military helicopters were hovering over the site and ambulances were evacuating the bodies of the victims, an AFP correspondent said.
The last major attack against a military site dates back to early March, a coordinated hours-long assault on the country's main military hospital in Kabul.
Officials said around 50 people were killed in that attack, though credible sources said it was more than double that.
That operation was claimed by the Islamic State group.
Disclaimer: No Business Standard Journalist was involved in creation of this content