Crowds ran in panic after mistaking a flashmob-style performance for a militant attack in a Spanish coastal resort, police and media said.