"Gunmen wearing Afghan army uniforms have launched a complex attack on an army compound in the outskirts of Mazar- e-Sharif",capital of Balkh province, ministry spokesman Dawlat Waziri told AFP.
At least one armed man continues to resist, he said, with another killed and a third arrested. He could not confirm how many attackers there were in total.
"So far we have counted eight dead and eleven wounded, all military, there are no civilian casualties," General Waziri said.
Several military helicopters were hovering over the site and ambulances were evacuating the bodies of the victims, an AFP correspondent said.
More From This Section
In a statement the Taliban claimed responsibility for the operation.
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, though credible sources said it was more than double that.
That operation was claimed by the Islamic State group.