Firefighters rushed to the Tomorrowland festival in Santa Coloma de Gramenet in northeastern Spain, and eventually managed to extinguish the blaze which caused no injuries, they said in a statement.
A total of 22,143 people had to be evacuated from the festival, they added.
Footage of the incident shows one side of the stage consumed by giant flames, a shower of sparks raining down as people ran away and black smoke billowing up.
It is not clear what caused the blaze, but organisers said on their Facebook page it was due to a technical malfunction.
"Thanks to the professional intervention of the authorities all 22.000 visitors were evacuated safely and without reports of injuries," they said.