Two Iranian border guards and one Taliban fighter were killed after shooting broke out near a border post between Iran and Afghanistan, a Taliban spokesman and Iran's state media said on Saturday.
It was not immediately clear what had provoked the incident, in which several people were also injured, but it came amid tensions between the two countries over water rights.
Iran has accused Afghanistan's Taliban rulers of violating a 1973 treaty by restricting the flow of water from the Helmand river to Iran's parched eastern regions, an accusation denied by the Taliban.
"Today, in Nimroz province, Iranian border forces fired toward Afghanistan, which was met with a counter-reaction," spokesman for the Taliban-run interior ministry, Abdul Nafi Takor, said in a statement.
"The situation is under control now. The Islamic Emirate does not want to fight with its neighbours," the spokesman said, without identifying the victims.
Read more: Iran closes Afghan border crossing after skirmishes with Taliban
He said one person had been killed on each side and several injured, though Iran's official IRNA news agency later said two Iranian border guards had been killed and two Iranian civilians injured.
Following the clash, Iranian authorities closed the Milak – Zaranj border post, a major commercial crossing – and not the site of the clash – until further notice, IRNA said.
Iran's deputy police chief, Qasem Rezaei, said earlier: "Without observing international laws and good neighbourliness, Taliban forces started shooting at the Sasoli checkpoint … drawing a decisive response," IRNA reported.
Iran's border guards said in a statement they had "used their superior heavy fire to inflict casualties and serious damage", IRNA reported, without giving details.
Enayatullah Khowarazmi, Taliban defence ministry spokesman, said: "Unfortunately, today once again in the border areas of Kong district of Nimroz province, there was a shooting by Iranian soldiers, (and) a conflict … broke out."
"The Islamic Emirate of Afghanistan considers dialogue and negotiation to be a reasonable way for any problem. Making excuses for war and negative actions is not in the interest of any of the parties," Khowarazmi said.
Earlier in May, Iranian President Ebrahim Raisi warned the Taliban over disregarding Iran's water rights under the 1973 treaty. The Taliban rejected Raisi's perceived threat, with a former Taliban official mocking Raisi in a video that went viral.