A lone police officer shot dead four of the five suspects who were in a car that was driven into pedestrians in the Spanish seaside town of Cambrils, it has emerged.
The occupants of the car had been wearing fake suicide vests and had knives and an axe, officials said.
Seven people were injured in the attack, one of whom later died.
It came hours after a van was driven into crowds in Barcelona, leaving 13 people dead and scores injured.
Police say the van driver, who fled the scene, could be among those killed in Cambrils, but this has not yet been confirmed.
"The investigation points in this direction," said Catalonian police official Josep Lluis Trapero, but there was no "concrete proof".
He added that, despite police training, it was "not easy" for the officer who had shot dead four of the five suspects.
The attack in Cambrils unfolded when an Audi A3 was driven at people walking along the seafront in the early hours of Friday.
The car overturned and those inside then attacked people with knives. Police said four were shot dead at the scene and the fifth was killed a few hundred metres away.
Waiter Joan Marc Serra Salinas heard the shots that rang out on Cambrils promenade.
"It was bang, bang, bang. Shouting, more shouting. I threw myself on to the ground on the beach," he said.
The Mayor of Cambrils, Cami Mendoza, praised the "speed and efficiency" of the police response.