Five terrorists wearing suicide belts rammed civilians with a car in a Spanish seaside town before being shot dead by police in a second attack to hit the country.
Seven people including a police officer were injured during the incident in Cambrils, hours after a rampaging van driver left 13 people dead and over 100 wounded in Barcelona.
Bystanders ran for their lives as a gunfire broke out close to the coastal town's beachfront promenade early on Friday morning.
Residents of the popular tourist spot were ordered to take cover indoors as bullets tore through the air.
In the wake of the carnage several controlled blasts were carried out in the area, with police later saying the attackers had been wearing explosive belts.
Mossos, Catalonia's police force, said four of the attackers were shot dead at the scene and later confirmed a fifth had died of his injuries.
Of the six civilians caught up in the attack two were said to be in a serious condition.
Investigators said they are working on the theory that the attacks in Cambrils and Barcelona, as well as an explosion in the town of Alancar on Wednesday, are linked.
A major manhunt for the suspected driver of the van that mowed down holidaymakers and locals in Barcelona, around 68 miles east of Cambrils, was continuing on Friday.
So far two people have been arrested over the attack that saw the Catalonia capital become the latest European city to fall victim to a major terrorist outrage.
Shortly after 5pm local time on Thursday a white Fiat van tore through Las Ramblas, a major tourist attraction packed with families and holidaymakers, in a horror described as "jihad terrorism" by the country's prime minister Mariano Rajoy.
The van drove on to the pavement, swerving among pedestrians in a crowded area, and was "clearly a terror attack intended to kill as many people as possible", senior police official Josep Lluis Trapero said.
The Islamic State terror group has claimed responsibility for the attack, the deadliest on Spanish soil since more than 190 people died in the Madrid train bombs in 2004.
According to the Catalan regional government citizens of some 24 countries were among those killed and injured, with one Belgian national confirmed to have died.
Prime Minister Theresa May said she was "sickened" by the incident and the Foreign Office was trying to determine if there were British victims.
Authorities have warned that the death-toll may rise, with 15 people receiving treatment for serious injuries.
Two suspects, a Spanish national from Melilla and a Moroccan, were arrested and taken into custody in the wake of the attack.
The arrests were made in the northern Catalan town of Ripoll and in Alcanar, the site of an explosion on Wednesday night which killed one person and is thought to be linked to the van attack, authorities said.
The whereabouts of the van driver were unclear after police said he made off unarmed.
There were also reports that detectives believe two vans were used, one for the attack and a second as a getaway vehicle.
Hours after Thursday's attack, police shot and killed a man who was in a car that hit two officers at a traffic blockade on the outskirts of Barcelona. However, Mr Trapero said it was not linked to the van attack.
Witnesses to the attack described how the van hurtled through crowds without slowing down, sending scores of people scattering and many taking shelter in nearby shops.
Lawyer and University of Glasgow rector Aamer Anwar told the Press Association: "I could see a woman screaming with her kids. People started running and jumping into shops.
"I ran for about 50 or 100 metres and stopped to see what was happening.
"The police were very quickly on the scene and getting people to move back."
Will Ako, 26, from London, was eating in a restaurant called Taller De Tapas with his family when they heard a disturbance.
He told the Press Association: "I then saw people running to the east of the restaurant and I saw a couple of people, about 30 yards down the road, crouching around what looked like someone on the ground and they were calling for assistance.
"Within a couple of minutes, police started to arrive and they were running west of the restaurant and some were telling us to stay inside.
"Soon after, loads of cars, bikes and ambulances arrived and then the armed police."
Mrs May said the UK "stands with Spain against the evil of terrorism" in the wake of recent attacks in Manchester and London.
"I am sickened by the senseless loss of life in Barcelona today," she said.
"The Foreign Office is working to establish if any British nationals were involved in this appalling incident and we are in close contact with the authorities in Spain, who have our full support."