The quake hit at 0422 GMT, the Spanish National Geographic Institute said, and was followed by six lesser aftershocks. The U.S. Geological Survey had earlier reported the tremor had a magnitude of 6.6 and was registered at 33 km (20 miles) deep.
Emergency services in the southern region of Andalucia said in a statement on their Twitter feed they had received 250 calls from alarmed residents.
The tremors and aftershocks were felt throughout the region, including in the cities of Malaga, Cordoba, Seville and Granada.
In Melilla, a Spanish enclave on the Moroccan coast, emergency services said they had received more than 200 calls from people warning of damage to properties. Schools would remain shut on Monday so buildings could be inspected.
Media in Melilla said power was being restored to areas where it had been cut.