NATO's Resolute Support Mission said an Afghan soldier also was among the wounded.
The 'insider attack' occurred at an Afghan National Army regional base, Camp Shaheen, in Mazar-i-Sharif. A U.S. soldier reportedly engaged and gunned down the assailant before wounded Americans were evacuated for treatment.
The Taliban did not claim any association with the attacker but did praise him, saying he would be remembered 'as a hero.'
In a similar attack earlier this month in eastern Nangarhar province, an Afghan commando opened fire on U.S. soldiers, killing three of them before he was gunned down by retaliatory fire.
The Taliban took credit for that attack, claiming the assailant was one of its fighters who had infiltrated Afghan army ranks.
The military base where Saturday's shooting took place was the scene of a coordinated Taliban gun-and-bomb raid in April that killed more than 150 soldiers and wounded many more, the deadliest assault on Afghan forces since 2001.