A magnitude 7.3 earthquake hit the region around the border between Iran and Iraq has killed at least 160 people state media in the two countries said, as rescuers searched for dozens trapped under rubble.

At least 160 people were killed in Iran, Behnam Saeedi, a spokesman for Iran's National Disaster Management Organization,said on the state television. More than 850 were injured, he said.

The earthquake was felt in several provinces of Iran but the hardest hit province was Kermanshah, which announced three days of mourning.

More than 97 of the victims were in the town of Sarpol-e Zahab in Kermanshah, about 15km from the Iraq border. The main hospital of the town was severely damaged and struggling to treat hundreds of injured people, state television reported.

Kurdish health officials also said at least four people were killed in Iraq and at least 50 injured.

The US Geological Survey said the quake measured magnitude 7.3.  An Iraqi meteorology official put its magnitude at  6.5 with the epicentre in Penjwin in Sulaimaniyah province in the Kurdistan region close to the main border crossing with Iran.

Electricity was cut off in several Iranian and Iraqi cities,and fears of aftershocks sent thousands of people in both countries out onto the streets and parks in cold weather.

"The night has made it difficult for helicopters to fly tothe affected areas and some roads are also cut off... we are worried about remote villages," Iranian Interior Minister Abdolreza Rahmani Fazli said in an interview on state television.

A quake registering a magnitude between 7 and 7.9 can inflict widespread and heavy damage.

Iran sits astride major fault lines and is prone to frequent tremors.

On the Iraqi side, the most extensive damage was in the town of Darbandikhan, 75km east of the city of Sulaimaniyah in the semi-autonomous Kurdistan Region.

More than 30 people were injured in the town, according to Kurdish Health Minister Rekawt Hama Rasheed.

The district's main hospital was severely damaged and had no power, Rasheed said, so the injured were taken to Sulaimaniyah for treatment. Homes and buildings had extensive structural damage, he said.

In Halabja, local officials said a 12-year-old boy died of an electric shock from a falling electric cable.

Many residents in the Iraqi capital, Baghdad, rushed from their houses and tall buildings in panic.