The Audi A3 car rammed into people on the seaside promenade of the tourist city 120 kilometres south of Barcelona, where a van had earlier sped into a street packed full of tourists, killing 13 people and injuring around 100 others.
One of the injured in Cambrils was in critical condition and died of her injuries later on Friday, emergency services confirmed.
- Barcelona terror attack: What we know so far
- IN PICTURES: Aftermath of Barcelona terror attack
- Two arrested after van ploughs through Las Ramblas crowds killing 13
Police carry out work on Las Ramblas where a van killed 13 people and injured more than 100. Photo: AFP
The five attackers in the car were shot dead, police added. Some of them wore what looked like explosive belts.
"The alleged terrorists were in an Audi A3 and apparently knocked down several people before coming across a police patrol and a shoot-out ensued," said a spokesman for the regional government of Catalonia, where Cambrils is located in Spain's northeast.
Markel Artabe, a 20-year-old restaurant worker, said he was on the seaside promenade when he heard what he initially thought were fireworks, but soon realised were gunshots.
He said he saw someone lying on the ground "with a gunshot in the head". The victim's friends were crying out "help", he added.
Joan Marc Serra Salinas, a 21-year-old waiter, said he heard many gunshots.
"And shouting. And more shouting. I jumped onto the beach and didn't move," he said.
Police said they were "working on the hypothesis that the terrorists shot dead in Cambrils could be linked to what happened in Barcelona".
The driver of the van in the Barcelona attack managed to escape and is still on the run.
Four other suspects, a Spaniard and three Moroccans, have been arrested.
In a further twist, the Spaniard was arrested in Alcanar, about 200 kilometres south of Barcelona and the scene of an explosion in a house late Wednesday that left one person dead and seven wounded and is believed to be linked to Thursday's assault.
"We suspect that they (the occupants) were preparing an explosive device," Josep Lluis Trapero of the regional Catalonia police told reporters.