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.