Afghan commandos were deployed during the attack which lasted several hours and targeted soldiers as they attended mosque and ate a meal.
Two of the ten attackers blew themselves up while seven were killed and one was detained.
"More than 50 Afghan soldiers have been killed" in a Taliban attack on their base near the northern city of Mazar-i-Sharif, a US military spokesman told AFP.
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 the "atrocity to an end".
The US has around 8,400 troops in the country with about another 5,000 from NATO allies assisting a much larger Afghan force in the war against the Taliban and other Islamist militants.
Nicholson in February told the US Senate Armed Services Committee in Washington that he needed "a few thousand" more troops to help train and assist the Afghan forces.
Afghan defence ministry spokesman General Dawlat Waziri said gunmen wearing Afghan army uniforms had launched the assault on the army compound on the outskirts of Mazar-i-Sharif, capital of Balkh province.
"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.
The attack began at around 2 pm (0930 GMT) and was over by early evening, he said.
Taliban spring offensive
The Afghan defence ministry gave an initial toll of eight soldiers killed and 11 wounded. Afghan officials tend to play down the toll from jihadist attacks.
Several military helicopters hovered over the site during the attack and ambulances evacuated the bodies of the victims, an AFP correspondent said.
The Taliban are preparing to launch their traditional spring offensive, although the lull in the fighting season was only partial this year.
The last major attack against a military site was in 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 ISIS group.
US-led NATO troops have been at war in Afghanistan since 2001, after the ousting of the Taliban regime for refusing to hand over Osama bin Laden following the 9/11 attacks in the United States.
Efforts to negotiate a lasting peace settlement between Kabul and the Taliban have repeatedly fallen through.
More than a third of the country is beyond the control of the Afghan government and many regions are fiercely contested by various groups.
Earlier this month the US military dropped its GBU-43/B Massive Ordnance Air Blast, dubbed the "Mother of All Bombs", in combat for the first time, killing 96 jihadists in IS hideouts in eastern Afghanistan.
The area has not been reopened to civilians since the bombing.
The attack triggered global shockwaves, with some condemning the use of Afghanistan as what they called a testing ground for the weapon, and against a militant group that is not considered as big a threat as the resurgent Taliban.
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)