Thirteen people died and dozens were injured when a van plowed into crowds in Barcelona's famous Las Ramblas area, Catalan police and local officials say.
The vehicle sped along the pedestrian area that is popular with tourists, mowing down people and sending others fleeing for cover.
Police say it was clearly a terrorist attack designed to kill as many people as possible. Two people have been arrested, but police say neither was the driver.
Spanish media reports said the driver of the white van, which had been rented in the city, fled the scene on foot.
Police have confirmed that a man who drove into police officers at a checkpoint in another part of Barcelona was shot dead by officers, but there is no evidence that he was connected to the attack in Las Ramblas.
They also say one person was killed on Wednesday night in an explosion at a house outside Barcelona. They believe this incident is connected with the attack.
Police have released a photo of a man named as Driss Oubakir, whose documents were used to rent the van involved in the attack.
Local media say he is in his 20s, and was born in Morocco. However, latest reports suggest he has told police he was not involved, and that his documents were stolen.
So-called Islamic State has said it was behind the van attack in Las Ramblas, saying in a brief statement carried by its Amaq news agency that it was carried out by "Islamic State soldiers". The group gave no further evidence or details to back this claim.
The attack happened at the height of the season in one of Europe's top tourist destinations.
Witnesses said the van deliberately targeted people, weaving from side to side as it drove down the boulevard. Vehicles have been used to ram into crowds in a series of attacks across Europe since July last year.