The shallow quake hit at 4:22 am (0422 GMT) 62 kilometres (39 miles) north of the Moroccan city of Al Hoceima and 164 kilometres east-southeast of Gibraltar, the USGS said.
It was followed by a 5.3-magnitude tremor.
In its initial assessment of the quake’s impact, the USGS said there was “a low likelihood of casualties and damage”.
Tremors were felt in the south of Spain and in the Spanish enclave of Melilla bordering Morocco, but the authorities reported no victims.
“For the moment there has been only material damage and we haven’t detected any that is very serious,” Isidro Gonzalez, a Melilla official, told Cadena Ser radio.
“Some high buildings have cracks,” he said, adding that part of facades and balconies had collapsed.
Authorities in Melilla have decided to keep schools closed as a precautionary measure to review the state of the buildings.
In the Malaga area in southern Spain, on the other side of the Strait of Gibraltar, many inhabitants also felt the earthquake.
In February 2004 a strong 6.3 earthquake that hit near Al Hoceima killed nearly 630 people.