The suspects in the attacks in Barcelona and Cambrils were planning one or more bigger attacks than those that were carried out, police say.
They said blasts on Wednesday in a town south of Barcelona deprived plotters of bomb material, so they executed simpler attacks using vehicles to ram crowds.
Police are seeking Moussa Oukabir, thought to be 17, and three others.
Oukabir is suspected of carrying out Thursday's attack on Barcelona's Ramblas, where 13 people died.
Scores of others were injured as a van driver zig-zagged along the famous tourist street.
Moussa Oukabir, a Spanish citizen from the northern Catalan city of Girona, is suspected of using his brother's documents to rent the van that mowed down people on the famous boulevard.
Hours later, police killed five suspected jihadists in a second vehicle attack in the town of Cambrils. A woman injured in that attack died later.
Police said the men killed in Cambrils were linked to the Barcelona attack, which the Islamic State (IS) group said it had carried out.
Spanish media, quoting unnamed police sources, said Oukabir was among those killed in Cambrils but there has been no official confirmation.
Spanish Prime Minister Mariano Rajoy has condemned what he called a "jihadist attack" in Barcelona. He has announced three days of national mourning and a minute's silence was held at noon (10:00 GMT) on Friday.
What lines of inquiry are police following?
Police say they are investigating the theory that the attacks were being prepared over a substantial period of time in a private house in Alcanar, a small town south of Barcelona.
Explosions ripped through the building on Wednesday evening, apparently caused by exploding gas canisters. One person was killed.
The explosives were being prepared for use in one or more attacks in Barcelona, police said.
Catalan Police Chief Josep Lluis Trapero said the actual attacks in Barcelona and Cambrils were "rudimentary" by comparison.
Who is being sought?
The driver of the van fled on foot after mowing down tourists and locals on Las Ramblas.
Catalonia's Interior Minister Joaquim Forn, quoted by the Associated Press, said: "We had local police on the scene, but we were unable to shoot him, as the Ramblas were packed with people."
Two images of the suspect Moussa Oukabir have been published, and police later issued a composite photo showing him and three other men - Said Aallaa, 18, Mohamed Hychami, 24, and Younes Abouyaaqoub, 22. All are Moroccan-born.
Later Police Chief Trapero said it was suspected that the driver of the Barcelona van was one of the five killed in Cambrils, though it was not clear that Moussa Oukabir was behind the wheel.
Spanish media say Oukabir rented two vans, the one used in the attack and another found hours later in the town of Vic, north of Barcelona, that was intended as a getaway vehicle.
His brother, Driss Oukabir, was arrested after reportedly turning himself in on Thursday.
Reports suggest Driss, who is in his 20s and was born in Morocco, told police he was not involved and that his documents had been stolen.
Three other arrests have been made. Two of the men are Moroccan, and the third was born in Melilla, the autonomous Spanish city on the north coast of Africa.
Police said three of the arrests were made in the Catalan town of Ripoll and one in Alcanar after Wednesday's explosions.
They gave the ages of the arrested men as 21, 27, 28 and 34.
What happened on Las Ramblas?
A Fiat van was driven down the pedestrianised avenue on Thursday afternoon, deliberately targeting people.
Las Ramblas is a central boulevard that runs 1.2km (0.75 miles) through the centre of Barcelona from the city's Plaça de Catalunya (Catalonia Square) to the Christopher Columbus monument at the seafront.
An American businessman who was just arriving in a taxi in Las Ramblas, said the van was "weaving left and right, trying to hit people as fast as possible. There were people lying on the ground".
What happened in Cambrils?
Seven people, including a police officer, were hit when a car was driven into them early on Friday in the popular seaside resort 110km (68 miles) south-west of Barcelona.
A woman victim later died in hospital.
The attackers' vehicle overturned and when the men got out they were quickly fired upon by police, media say. One was reportedly brandishing a knife.
Police Chief Trapero said one officer killed four of the attackers single-handedly.
The men were wearing what appeared to be explosive belts, police said, and a series of controlled explosions was carried out. The belts proved to be fake, Catalan regional head Carles Puigdemont later told local radio.
Who were the victims?
Citizens of some 34 countries were killed or injured in the Las Ramblas attack, the Catalan government has said. One woman died in Cambrils.
- Spaniard Francisco López Rodríguez, in his 60s
- Italian Bruno Gulotta, 35
- Italian Luca Russo, 25
- Unnamed Belgian
- Unnamed US citizen
France's foreign ministry said on Friday that 26 French nationals were injured, with at least 11 in a serious condition.
Thirteen German citizens were wounded, some seriously. A five-year-old Irish boy suffered a broken leg.
Seven-year-old Julian Cadman, a dual British-Australian national who was separated from his mother during the attack, is missing, ABC Australia reports. His mother was reportedly among the seriously injured.
Taiwan and Greece are among those saying their citizens were injured. Pakistani, Philippine, Venezuelan, Romanian, Peruvian, Dutch, Danish, Algerian and Chinese nationals were also among the casualties, officials said.
What is the timeline of events?
- Alcanar, Wednesday evening: An explosion rips through a house in the small town, 200km south of Barcelona. One person dies. Police chief Josep Lluis Trapero said it appeared the residents at the house had been "preparing an explosive device". A Catalan government official says a cell may have intended to use gas canisters in the Las Ramblas attack
- Barcelona, Thursday 16:50 (14:50 GMT): A white Fiat van drives down Las Ramblas in central Barcelona, killing 13 people and injuring scores. The driver flees on foot
- Vic, Thursday 18:30: Police find a second van, thought to be a getaway vehicle, in the town, 80km north of Barcelona
- Sant Just Desvern, Thursday 19:30: A car is driven into officers at a checkpoint on the outskirts of Barcelona. A man is found dead in the car but the interior ministry denies earlier reports he was killed by police gunfire. The dead man is not believed to be linked to the Las Ramblas attack, officials say, but investigations are ongoing
- Cambrils, Friday 01:00: A second vehicle attack takes place in the resort south of Barcelona. Police kill five terrorist suspects said to be linked to the Las Ramblas attack
Analysis: A failure of intelligence?
Frank Gardner, BBC security correspondent
What looked at first to be a lone-wolf attack by just one - or possibly two - individuals, has now emerged as a complex plot involving at least eight suspects, armed with knives and explosives. That's an unusually large network for this day and age, where so-called Islamic State cautions its followers to avoid big groups so as to escape detection.
It suggests both an element of careful planning by the perpetrators and also a failure of intelligence by the normally-vigilant Spanish authorities. Spain has not experienced anything like this since al-Qaeda staged multiple bombings in Madrid in 2004.
But Spanish police, working closely with their Moroccan counterparts, have arrested dozens of suspected plotters in recent years, many with connections to the two Spanish enclaves on Morocco's north coast. Melilla and Ceuta have a reputation of being hotbeds of extremist activity and both have provided jihadists with a gateway into the Spanish mainland.
Throughout the day online supporters of IS have been celebrating the Barcelona attack. Some have even expressed their hope it will change the course of Spanish politics, forcing the government to pull out of the US-led Global Coalition that is rapidly degrading what's left of IS's self-styled caliphate in the Middle East.
Are you in the area? Did you witness what happened? If it's safe to do so, you can share your experience by emailing email@example.com.
Please include a contact number if you are willing to speak to a BBC journalist. You can also contact us in the following ways: