According to local officials, the incident took place early Thursday morning in the 9th district of Herat city.
Provincial police spokesman, Abdul Rauf Ahmadi said at least three soldies were also injured following the attack.
He said the militants ambushed the vehicle of the Afghan soldiers while they were on their to Zafar military base.
In the meantime, defense ministry spokesman, Gen. Zahir Azimi said at least two soldiers were martyred and two others were injured following the attack.
No group including the Taliban militants has so far claimed responsibility behind the incident.