The majority of those who died were in Iran's western Kermanshah province. Nearly 4,000 were said to be injured.
Seven people died in Iraq, where people fled into the streets in the capital, Baghdad.
Mosques in the city have been broadcasting prayers through loudspeakers.
"I was sitting with my kids having dinner and suddenly the building was just dancing in the air," a Baghdad mother-of-three, Majida Ameer, told Reuters news agency.
"I thought at first that it was a huge bomb. But then I heard everyone around me screaming: 'Earthquake!'"
Iranian state news agency Irna quoted an emergency official as saying 3,950 were injured in Iran alone.
Most of the victims were in the town of Sarpol-e Zahab, about 15km (10 miles) from the border, Iran's emergency services chief, Pir Hossein Koolivand was quoted as saying on Iranian state television channel Irinn.
The town's main hospital was severely damaged, leaving it struggling to treat hundreds of wounded, state TV reported.
Many homes in the mountainous area are made of mud bricks and are at risk of collapse in a significant earthquake like the one that struck on Sunday.
Damage was reported in at least eight villages, the head of Iran's Red Crescent Organization, Morteza Salim, told the channel.
"Some other villages have suffered power cuts and their telecommunications system has also been disturbed," he said.
Rescue teams were being hampered by landslides, Mr Koolivand said.
On the Iraqi side, the most extensive damage was in the town of Darbandikhan, 75km (47 miles) east of the city of Sulaimaniyah in the Kurdistan Region.
"The situation there is very critical," Kurdish Health Minister Rekawt Hama Rasheed told Reuters.
The Iraqi ministry of health said 321 people had been wounded in the Iraqi Kurdistan region.
The BBC's Rami Ruhayem, in the regional capital Irbil, said shaking there lasted for more than a minute.
"For a few seconds at first it was barely detectable, I wasn't sure whether it was a minor tremor or just my imagination," he said. "But soon enough it was unmistakable as the building started swaying from side to side."