Three of the militants were killed by Iranian forces in the fighting Monday in the southeastern town of Negur, the state-run news agency IRNA reported.
The news agency cited Ali Asghar Mirshekari, the deputy governor of Iran's Sistan-Baluchestan province, who said the militants crossed into the country from Pakistan. Iranian officials have reportedly asked Pakistani authorities to catch the surviving assailants.
A militant group called Jaish al Adal claimed responsibility for the attack, according to Iranian state media and a Twitter account believed to be associated with the organization.
According to Pakistani media, Jaish al Adal is an anti-Iranian group that has emerged during recent years in areas of Balochistan, the restive Pakistani province that borders southeastern Iran.
The Sunni Muslim group has targeted Shiites and says it aims to thwart Iranian influence in Pakistan, according to the Pakistani newspaper Dawn.
Pakistan condemns 'act of terrorism'
Jaish al Adal has also claimed responsibility for attacks on Iranian territory.
One of the deadliest was in October 2013, when 14 Iranian border guards were killed near the city of Saravan.
Iranian authorities say that after similar attacks, the militants have fled back into Balochistan.
"Iran has repeatedly criticized its eastern neighbor for failing to rein in the terrorists," IRNA said, referring to Pakistan.
The Pakistani government condemned Monday's attack, calling it an "act of terrorism."
"The concerned security agencies of Pakistan are actively investigating this incident, which took place on Iran's territory, and have asked Iranian authorities to share with us any evidence that they have," the government said in a statement Wednesday.
If the militants entered Pakistan after the attack, "they will be apprehended and brought to justice," it said.