The 7.3-magnitude quake hit a border area 30 kilometres southwest of Halabja in Iraqi Kurdistan at around 9:20 pm, local time on Sunday, when many people would have been at home, the US Geological Survey said.
The worst affected areas were in Iran’s western province of Kermanshah, where the coroner’s office told state television that at least 407 people were dead and another 6,600 injured.
Across the border in Iraq, where the areas are more sparsely populated, the health ministry said eight people had died and several hundred been injured.
Some Iranians spent the night outdoors after fleeing their homes in the mountainous cross-border region, huddling around fires at dawn as the authorities deployed help to affected areas.
A woman and her baby were pulled out alive from the rubble in the Iranian town of Sar-e Pol-e Zaham, the worst hit in the quake, local media reported.
Officials said they were setting up relief camps but that access to the areas was not easy.
Iran’s emergency services chief Pir Hossein Koolivand said it was “difficult to send rescue teams to the villages because the roads have been cut off… there have been landslides”.
The official IRNA news agency said 30 Red Cross teams had been sent to the quake zone, parts of which had experienced power cuts.
Iran’s supreme leader Ayatollah Ali Khamenei ordered the government and armed forces to mobilise “all their means” to help the population.
Local media reported hundreds of ambulances and dozens of army helicopters mobilised for rescue operations including in rural areas.
Sar-e Pol-e Zahab, an area of some 85,000 people close to the border, was the worst hit, with at least 236 dead, while the towns of Eslamabad and Qasr-e Shirin were also affected.
Some 259,000 people live in the areas around these towns, according to the latest population census.
State television footage showed tents, blankets, and food being distributed in areas hit by the quake.
At dawn on Monday in Sar-e Pol-e Zahab, buildings stood disfigured, their former facades lying in rubble on crumpled vehicles.
In an open space away from the wrecked housing blocks, men and women, some wrapped in blankets, huddled around a camp fire to keep warm.
In Iraq, the health ministry said the quake had killed seven people in the northern province of Sulaimaniyah and one in the province of Diyala to its south.
More than 500 people were injured in both provinces and the nearby province of Kirkuk.
Footage posted on Twitter showed panicked people fleeing a building in Sulaimaniyah, as windows shattered at the moment the quake struck, while images from the nearby town of Darbandikhan showed walls and concrete structures had collapsed.