Spanish authorities have a suspect in custody and are investigating the attack as a potential act of terrorism.