The epicentre of the quake, which occurred at around 09:18 pm local time on Sunday (0010 GMT on Monday), was 32 kilometers south of the Iraqi city of Halabja, in Iraqi Kurdistan, and just across the border from Iran, according to the United States Geological Survey (USGS).
But the highest casualties occurred in the town of Sarpol-e Zahab, in Iran's Kermanshah Province.
According to the National Disaster Management Organization of Iran, 328 people were confirmed dead as of Monday noon. Some 2530 others were injured.
The organization says power cuts have been reported in Kermanshah Province. A number of villages in western Iran have also seen destruction of varying degrees.
Leader orders swift rescue operations
Soon after the quake occurred, Leader of the Islamic Revolution Ayatollah Seyyed Ali Khamenei issued a message calling on all Iranian officials and institutions to "rush to the aid of those affected in these early hours [after the incident]."
The Leader said the country's entire range of capabilities had to be used swiftly to prevent a further rise in the death toll.
Ayatollah Khamenei called on Iran's Armed Forces to help with removing the rubble and transferring the injured to medical centers.
Separately, Iranian President Hassan Rouhani spoke on the phone with Iranian Interior Minister Abdolreza Rahmani-Fazli on Sunday night, who briefed the president on the latest updates. President Rouhani then issued the necessary directives to facilitate and accelerate rescue operations.
Three days of mourning have been announced in Kermanshah.
The earthquake was felt in cities in several other Iranian provinces, including as far away as in the capital, Tehran.
The quake also shook the Iranian provinces of Kordestan, Ilam, Khuzestan, Hamedan, West Azarbaijan, East Azarbaijan, Lorestan, Qazvin, Zanjan, and Qom.
But the casualties and damage were limited to Iran and Iraq.
Meanwhile, Rahmani-Fazli, the Iranian interior minister, has flown to Kermanshah Province to personally oversee the rescue operations.
Reports said 11 people had been killed in Iraq. Some 130 Iraqis were also injured.
In Iraq, the most extensive damage was in the town of Darbandikhan, 75 kilometers east of the city of Sulaymaniyah, in the semi-autonomous Kurdistan Region.
According to Kurdish Health Minister Rekawt Hama Rasheed, over 30 people were wounded in the town. "The situation there is very critical," he said.