At least two people were seriously injured and some homes had burned.
The fire reached the edge of the wealthy resort of Marbella early Friday after engulfing 8 miles of coastline lined with vacation homes, the BBC reported.
More than 1,000 people left their homes as the flames neared Marbella. About 3,300 were evacuated from Ojen and an unknown number from a campsite at Alpujata.
Crews in about 17 aircraft aided 250 firefighters on the ground.
The fire started Thursday near Malaga and had burned nearly 2,500 acres.
Hot dry weather has led to a number of wildfires throughout Spain this summer, including major fires in Catalonia and the Canary Islands.