Another seven soldiers were wounded in the siege in Sari Pul province, which the local government pinned on the Taliban.
An Afghan official says the Taliban attacked an army checkpoint in one of the country's northern provinces, killing at least six soldiers.
Zabihullah Amani, the provincial governor's spokesman, says seven soldiers were also wounded in the attack late Thursday night in Sozma Qala district in Sari Pul province.
Amani says nine Taliban fighters were killed and 13 were wounded in the gun battle.
He added that reinforcements were dispatched to the area and that it is now under control of Afghan forces.
The Taliban did not immediately claim the attack but the insurgents have been carrying out near-daily attacks on Afghan forces.
The violence comes despite stepped-up efforts by the United States and the Afghan government to find a negotiated end to the country's 17-year war.