More than 160 people were wounded, said Mohammad Ibrahim Khair Andesh, the head of Balkh's provincial council, on Saturday.
The attack took place at an army command centre a few kilometres from Mazar-e Sharif, the capital of Balkh province.
Taliban militants in three military vehicles with forged documents launched the attack by shooting a rocket at the entrance of the army base, a military official told dpa.
Ten militants first targeted a mosque inside the base where army staff were performing Friday prayers before moving on to a dining facility, the source said.
The Taliban claimed that more than 500 soldiers were killed and wounded. The militant group also claimed that four of the attackers were soldiers who had served at the base and had knowledge of the facility.
The militants released a picture of the purported attackers, dressed in military gear, with their faces blurred.
The army corps in Mazar-e Sharif is the command centre for northern Afghanistan and where a contingent from the German army is based. No German soldiers were affected by the attack.
This is the second such attack on a secure facility in recent months. In early March, Daesh militants attacked a military hospital in Kabul, killing 49 people and leaving 76 wounded.
© 2019 dpa GmbH