Spanish police say they have killed five people in the town of Cambrils to stop a second attempted van attack after an earlier one in Barcelona.
The attackers were wearing explosive belts, police said.
Thirteen people died and dozens were injured when a van ploughed into crowds in Barcelona’s Las Ramblas area on Thursday afternoon. The driver of the van fled and is still at large.
Spain’s Prime Minister Mariano Rajoy said it was a “jihadist attack”.
The authorities are now linking the attacks in Barcelona and Cambrils with an explosion at a house on Wednesday evening in the town of Alcanar that left one person dead.
Earlier, police chief Josep Lluis Trapero said it appeared the residents at the Alcanar house had been “preparing an explosive device
In Cambrils seven people including a police officer were wounded when a car was driven into a group early on Friday, Catalan emergency services said.
Spanish media reported that the attackers’ vehicle overturned and when the men got out they were quickly fired upon by police.
Police say the situation in Cambrils – a popular seaside resort to the south-west of Barcelona – is now under control.
A bomb squad is to carry out controlled explosions on the attackers’ explosive belts.
Meanwhile police are continuing to search for the driver of the van used in the Barcelona attack, who fled on foot.
Tourists and locals fled when the rented vehicle sped down Las Ramblas in the centre of the city, mowing down people.
Witnesses said the van deliberately targeted people, weaving from side to side as it drove down the boulevard.
Two people have been arrested, but police say neither was the driver.
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 Las Ramblas attack, 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.
Vehicles have been used to ram into crowds in a series of attacks across Europe since July last year.
In another incident, police shot dead a man who drove into officers at a checkpoint on the outskirts of Barcelona, but the authorities said there was no evidence that he was connected to the attack in Las Ramblas.
Analysis: A worrying trend
Gordon Corera, BBC News security correspondent
Barcelona is just the latest European city to witness the terrible effects of a vehicle attack on an iconic or “soft” target.
In Nice a year ago, Bastille Day celebrations were targeted, then a Christmas market in Berlin. In London, Westminster and London Bridge, as well as Finsbury Park, saw cars and vans used as weapons.
In the UK, new barriers have been put in place to mitigate some of the risks at key locations and there is discussion of imposing checks on those renting vans, but security services in Britain – as well as across Europe – are all too aware that there are limits to what they can do to spot and stop those planning murder in this way.
The weapons employed are readily available and there is little or no training, co-ordination or planning required. This means there are few points where individuals can be spotted by the intelligence services.
Although so-called Islamic State has released a statement saying what it calls its “soldiers” had carried out the Barcelona attack, it is not yet clear whether there was any direct link to the group or if they were simply inspired by its call to act. The language used often indicates the latter.
Either way, authorities will be bracing themselves for the possibility of further attacks of a similar nature.
What did people see in Barcelona?
A businessman from New Orleans, who was just arriving in a taxi in Las Ramblas, said: “I heard a crowd screaming. It sounded like they were screaming for a movie star.
“I saw the van. It had already been busted on the front. It was weaving left and right, trying to hit people as fast as possible. There were people lying on the ground.”