Videos on social media showed embers dropping from a large stage decoration, before spreading across the speaker system and a big screen.
One witness told Sky News it happened in less than three minutes.
Authorities said the stage was "totally destroyed" but no injuries have been reported and the fire is out.
An area packed with pyrotechnics that were going to be used at the end of the 12-hour festival had been secured, they added.
No official explanation has yet been given for how the fire started but local media blamed fireworks.
Tomorrowland Unite is a round-the-world live-screening of the main Tomorrowland festival, held in Belgium.
A promotion for the event says that "special effects are synchronised with the show in Belgium adding value to the global connection".
The Barcelona event was listed as cancelled on Tomorrowland's website.
A statement read: "Tonight, July 29th 2017, the UNITE Barcelona stage caught fire 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.
"Authorities will follow up and continue the investigation with the local Spanish organiser of UNITE."
Aoki, best known for his collaboration with One Direction star Louis Tomlinson on the track Just Hold On, had been due to begin a set at 2am local time.
More about: #Barcelona #fire