BARCELONA — People danced past dawn at Sónar, the annual festival of electronic-oriented music, which had its last D.J.s pumping out bass propulsion until 7 a.m. Sónar unites Spain’s late-night culture with the euphoric stamina of fans of techno, house and other varieties of music that use machines to generate sweaty motion. This year’s festival, which ran from Thursday through Sunday, was the 24th annual Sónar and the largest, with 123,000 visitors.

Sónar has built itself into a European institution and a trademark strong enough for spinoffs in, among other places, Reykjavik, Buenos Aires and Tokyo. On home turf, its June flagship is a magnet for laptop-wielding musicians; during Sónar’s long weekend, even performers who aren’t among the festival’s 140 acts swarm to Barcelona to play “off-Sónar” gigs at bars, clubs and warehouses. The festival’s outlook is determinedly futuristic, with a sidebar conference — Sónar Plus D — that has virtual-reality showcases and musicians mingling with software innovators. Meanwhile, its bookings honor both past and present, spanning 1970s disco from Cerrone, 1990s hip-hop from De La Soul and current British grime from Giggs.