The EMSC registered the tremor 87 kilometers (54 miles) northwest of Ilam, a Kurdish-majority city in western Iran, and 141 kilometers (87 miles) northeast of Iraqi capital Baghdad.
The EMSC said the epicenter was at the depth of 20 kilometers (12 miles). A shallower 4.1-magnitude aftershock was reported closer to the border minutes later.
The agency estimated the population in the area where the quake was felt at around 30 million. There were no immediate reports of casualties or damage.