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 and footage later showed several lifeless bodies on the ground.
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."
Fitzroy Davies, from Wolverhampton, was caught up in the second attack in Cambrils and described how police shot dead one of the attackers.
He told the BBC he was in Spain for a judo camp and was in a meeting with the coaches when the incident unfolded.
"These girls ran into the bar off the street and then people were running up the road.
"One of our guys stood up, looked and just said 'run', so we all ran.
"This guy came running up the road and was shouting something.
"I didn't know what it was, so we said call the police.
"Within 30 seconds the police was already there, jumped out of the car, started shouting at the guy, the guy was then saying something else again.
"And then they 'pop, pop', did a couple of shots and he fell down.
"He stood back up and then he stepped over the fence and he started, he was taunting, smiling and he carried on walking to the police, and then they gave it to him again, a couple more shots and then he fell to the ground."
An Irish family was caught up in the terror attack in Barcelona.
The mother and father were originally from the Philippines and are naturalised Irish citizens while their two children were both born in Ireland.
Their injuries are understood to be non life-threatening.
Ireland's Department of Foreign Affairs is assisting the family.