Spanish police early Friday said they had killed five terrorists who reportedly tried to mow down pedestrians in the resort town of Cambrils, hours after a similar terror attack in Barcelona.
"We are working on the hypothesis that events in Cambrils were a terrorist attack. We have killed its alleged perpetrators," Catalan police wrote on Twitter.
The news came hours after police launched a manhunt for the driver of a van who ploughed into crowds of people on one of Barcelona's busiest thoroughfares, killing 13 people and injuring 100.
Seven people were injured in the attack in Cambrils, 120 kilometres south of Barcelona, including one police officer.
Local media said the attackers drove off after police tried to carry out a check, aiming at pedestrians as they went. The police gave chase, the vehicle then overturned and the men were shot dead as they tried to flee.
Bomb disposal experts were trying to determine whether the men had been wearing explosives belts and police warned that controlled explosions were being carried out.
Catalonia police said they believed the two attacks, as well as an explosion on Wednesday night in Alcanar, 200 kilometres south of Barcelona, in which one person died and a house collapsed, were all connected.
However, Catalan police chief Josep Luis Trapero earlier said that there was so far no evidence that another incident, in which police shot dead a man after he tried to evade a checkpoint while leaving Barcelona hours after the first attack, was linked.
The Daesh terrorist group said via its affiliated Amaq news agency that its "soldiers" were responsible for the attack on Las Ramblas, a popular tourist spot in Barcelona.
Trapero said two men had been arrested in connection to the attack, a Moroccan and a Spanish national from the North African Spanish enclave of Melilla. Neither were known to have any previous links to terrorism.
However, a third man believed to have been the driver of the van, was still on the run, Trapero told reporters.
The attack on Las Ramblas was "obviously a terrorist attack [carried out] with the intent to kill as many people as possible," he said.
The Belgian government confirmed that one of its nationals was among those killed in Barcelona, though Catalonia authorities would only say that people of 20 nationalities had been killed or injured.
The government in Berlin could not confirm a report by the broadcaster ZDF that three Germans were among the dead.
Catalonia's Interior Minister Joaquim Forn said he expected the death toll to rise.
Spanish Prime Minister Mariano Rajoy, who cut short his holiday to travel to Barcelona, announced three days of official mourning and launched a staunch defense of democratic values.
"We are not only united in mourning. We are above all united in the resolute will to defeat those who want to take away our values and our way of life," he said.
Witnesses said the white van used in the Barcelona attack drove at around 80 kilometers an hour into pedestrians, zigzagging to hit as many people as possible.
Albert Zeitler, a German at the scene near the area's Museum of Contemporary Art, told dpa by phone that it felt like a "war zone."
"Police with machine guns and weapons were running at me. Everyone fled into the shops," he said. "I've never experienced anything like it."
Another witness, Erminia Mata told the El Mundo newspaper there were "a lot of people lying on the ground, covered with blood."
Spanish media released video footage of the scene showing motionless bloodied bodies strewn across the street.
Videos on social media showed a van traveling with its side door wide open at high speed down a pedestrian area.
Europe has been hit by a series of deadly terrorist attacks using vehicles over the last two years including deadly incidents in Nice, Berlin and two in London.
Spain's worst terrorist attack was in March 2004 when 191 people were killed by bombs planted by terrorists on commuter trains in Madrid.