The deadly roadside bombing, according to the official, took place Saturday evening, killing six guards of the railway and injuring two others, Xinhua reported.
Without providing more details, the official added that investigation had been initiated into the incident.
In the meantime, the railway authority in a statement described the attack on railway guards as enmity against the country's development and condemned it.
The Herat-Khawaf railway, which was inaugurated a couple of months ago, connects the war-battered Afghanistan to the railway network of the neighboring Iran onward to Turkey.