There were no immediate reports of casualties or damage.
The official news agency IRNA said the epicentre of the quake was near the Gulf island of Qeshm, around 35 kilometres (20 miles) from the port city of Bandar Abbas. The island is home to some 120,000 people.
The quake hit at 1:53 pm (1023 GMT) and was felt for more than 10 seconds.
"The earthquake was felt in Bandar Abbas," IRNA said, adding that residents there "rushed out of their homes after the quake."
The quake was also felt across the Gulf in the United Arab Emirates where residents fled high-rise office and apartment blocs.
"I took my baby and ran down the 10 flights to the street," one alarmed resident of Dubai told AFP.