At one stage over 100 firefighters and volunteers, backed by water-dropping aircraft, battled the blaze which broke out on Tuesday afternoon amid scorching temperatures near La Linea in the province of Cadiz in the southwestern region of Andalusia, local emergency services said.
The beachside Hotel Aldiana in La Linea was forced to evacuate 380 guests, most of them from Germany, as well as staff because of the approach of the flames, a hotel spokeswoman said.
"The fire has been brought under control but there is still a strong smell of smoke. The hotel did not suffer any damage," she said.
The guests spent Tuesday night in a sports centre and were due to start returning to the hotel on Wednesday evening, the spokeswoman said.
Another 120 people ere evacuated from a hostel in the nearby town of San Roque, local officials said.
Local emergency services said the wildfire was under control but dozens of firefighters were still at the scene to completely extinguish the flames.
Every year millions of tourists visit the Costa del Sol, or Sun Coast, famed for its beaches and nightlife. Hundreds of thousands of expatriates from northern Europe live on the coastal belt.