Here is a timeline of events leading up to the attacks, including police on Monday saying they had shot dead a man.
The accident deprived a jihadist cell of bomb material they planned to use in a larger attack and prompted them to instead use vehicles to plough into pedestrians, killing 14 people.
Here is a timeline of events leading up to the attacks, including police on Monday saying they had shot dead a man would could be the alleged fugitive driver of the Barcelona van, Younes Abouyaaqoub:
The jihadist cell is already in Alcanar, according to their neighbour Martine Groby, a 61-year-old French retiree.
"They were very discreet, too discreet. The shutters were closed, there was no music, no children, no women," she told AFP.
She said her father, a former policeman, told her the young men living next door were "terrorists" and told her to take down their number plates.
He found it strange that they kept coming and going all day.
"I should have listened to him," said Groby, her eyes welling with tears.
An explosion at a house some 200 kilometres (120 miles) southwest of Barcelona kills one person and seriously injures another. Six other people are slightly injured.
The blast is so strong it is heard four kilometres away. The explosion may have been caused by a canister of butane and propane gas, local TV reported.
It was not known at the time that the house stored the ingredients needed to make the Islamic State group's preferred explosive, triacetone triperoxide, or TATP.
The explosive has been used in attacks in London, Paris, Brussels and Manchester.
One of the attackers, Said Aallaa, tells his family that he is going out with a friend. He leaves his home in Ripoll in northern Catalonia and travels some 200 kilometres to the seaside resort of Cambrils.
Aallaa was in a car that hours later rammed into pedestrians in Cambrils, leaving one woman dead after one of the assailants jumped out of the vehicle and stabbed her with a knife.
A second, smaller explosion rocks the house in Alcanar. At the time police, who at this point still had not linked the house to terrorism, were removing rubble with an excavator.
Six police officers, two firefighters and the driver of the excavator are injured.
A white van speeds into people along a 500 metre (1,600 feet) stretch of the pedestrian concourse at the centre of Barcelona's most famous street, Las Ramblas, killing 13 people and injuring over 100 others.
The suspect driver and only passenger of the van, Younes Abouyaaqoub, 22, escapes on foot, disappearing into the city's most famous food market, La Boqueria.
Abouyaaqoub arrives at Barcelona's univerity zone about six kilometres (3.5 miles) away where he approaches a car and stabs to death its occupant, 34-year-old Pau Perez.
He throws Perez's body in the back seat of the Ford Focus and drives away.
Shortly after Abouyaaqoub comes up against a police checkpoint. He forces the stolen car through, injuring a police officer. Police fire shots at the car.
Officers find the stolen car with a body of a man inside in Sant Just Desvern, a town just outside of Barcelona.
Police believe at first that the man died from their gunshots but they later realise he was stabbed. On Monday they announced that the body was that of Perez.
The chief of Catalonia's regional police, Josep Lluis Trapero, says for the first time that the vehicle attack in Barcelona is linked to the explosion at the house in Alcanar.
Moussa Oukabir, 17, Mohamed Hychami, 24, and Said Aallaa, 18, along with two other unnamed accomplices drive an Audi A3 into pedestrians on the promenade at Cambrils.
They try to force their way through a police checkpoint and injure one officer. They then get out of the car wearing fake explosives belts and armed with knives and axes.
A police officer shoots four of them dead. A fifth attacker tries to flee and another police officer shoots him dead.
Before he was shot he had time to stab a woman who later died, becoming the 15th victim of the attacks.
Police said they had shot dead a man wearing what appeared to be a suicide belt, and could be Younes Abouyaaqoub, the alleged fugitive driver of the van that mowed down crowds in Barcelona, a source close to the probe said.
Police confirmed the shooting, but did not identify him.