The earthquake took place at around 10:38am (4:38pm, Singapore time), with its epicentre in the town of Alhendin, 10 kilometres (six miles) south of Granada, according to the National Geographical Institute.
It was the strongest in a series of earthquakes to hit the region on Tuesday morning, sending residents rushing out of buildings and into the streets.
Three people were lightly injured, including a girl who was taken to hospital, said Antonio Sanz, the Andalusia region's top emergencies official.
Emergency services said they received more than 500 calls reporting cracks, falling debris and other earthquake-related incidents, including a dozen requests for medical assistance, mostly for anxiety attacks.
"Everything came crashing down. It was terrifying," Cristina Ruiz Lopez, a lab worker who was at a supermarket in Granada when the earthquake hit, wrote on X.
Toni Quinones, a social worker in the town of La Zubia about five kilometres southeast of Granada, said firefighters were "working continuously" in her neighbourhood.
"In addition to cracks and other damage, chimneys are falling, causing more serious damage," she wrote on X.
Conservation teams and experts were checking Granada's Alhambra palace, a UNESCO-listed jewel of medieval Islamic architecture and the seat of Spain's last Muslim kingdom, the site wrote on X.
The Alcazaba, the complex's historic fortress and oldest section, was evacuated after the earthquake, while access to the Nasrid Palaces was suspended, it added.
"ANGUISH"
Granada mayor Marifran Carazo urged people to stay at home and "above all, if there is another tremor, avoid going outside and standing alongside buildings".
"I know the anguish we experienced this morning, especially among our elderly people and young children, who had never experienced a situation like this before."
The quake comes after a magnitude-5.0 earthquake woke residents in Granada shortly after 1am on Saturday.
No injuries were reported from that quake, possibly because there were fewer people in the streets at that hour, although damage was reported in some buildings.
"Experts point out that it is possible for seismic movements and aftershocks to continue in the area," the head of the regional government, Juan Manuel Moreno, wrote on X, urging "maximum caution".