Catalan police say they have shot dead five people to foil a second vehicle attack hours after a van ploughed into people in Barcelona, killing 13.
The attackers were immediately fired upon by armed officers after they drove their car into a crowd in Cambrils at around 1am local time, injuring six civilians - two seriously - and a police officer.
The police force for Spain's Catalonia region said the five suspects shot and killed in the resort town were carrying suicide belts, which had been detonated by the force's bomb squad.
The belts were later confirmed to have been fake.
The force previously said it was working on the theory that the Cambrils suspects were linked to an attack late Thursday afternoon on Barcelona's Las Ramblas area and an earlier explosion in the town of Alcanar in which one person was killed.
The regional police said they could not yet confirm how the civilians and police officer were injured in Cambrils, a small port town around 70 miles south of Barcelona. Local media have reported a vehicle crashed into a police car and nearby civilians and that police shot the attackers, included one brandishing a knife.
A spokeswoman for the force said that officers shot dead four alleged perpetrators, with a fifth later dying from injuries sustained during the raid.
We work with the hypothesis that the incident of #Cambrils respond to a terrorist attack. We have shot down the perpetrators— Mossos (@mossos) August 18, 2017
It added that the suspects tried to carry out a similar attack to the one in Barcelona, when a van ploughed into people on Las Ramblas, killing 13 and leaving scores more injured.
Spain's public broadcaster, RTVE, ran a video of Cambrils' promenade in which volleys of gunshots could be heard while sirens wailed and people's screams could be heard.
Catalan president Carles Puigdemont thanked police involved in the operation in these "critical and tragic hours".