There have been two attacks in Spain’s Catalonia region involving people driving cars at crowds at high speeds.
Here is what we know so far.
On Thursday afternoon at 16:50 local time (14:50 GMT) a white van smashed into people on Las Ramblas, a famous boulevard in central Barcelona that runs 1.2km (0.75 miles) and was packed with tourists.
The van driver is said to have zig-zagged to try and hit as many people as possible along the pedestrianised area, knocking many to the floor and sending others fleeing for cover in shops and cafes.
He killed 13 people and injured more than 100, and managed to flee the scene.
Spanish police have described it as a terror attack.
What was the second attack?
About eight hours later, an Audi A3 car ploughed into pedestrians in the popular seaside resort town of Cambrils, 110km (68 miles) south-west of Barcelona, authorities said.
A woman who was critically injured later died in hospital. Five other civilians and a police officer were hurt.
The attackers’ vehicle overturned and five people who got out, some of whom were wearing fake suicide belts, were then shot by police. Four died at the scene and one later died of his injuries.
- Read the latest updates on the Spanish attacks
- Spanish police stop second attack
The Las Ramblas and Cambrils attacks are believed to be linked.
Who are the main suspects?
The key suspect had been Moussa Oukabir, 17, who was said to have used documents belonging to his brother, Driss Oukabir, 28, to rent the van that mowed down people on Las Ramblas and a second vehicle, later found in the town of Vic and believed to be a getaway car.
But late on Friday, police changed their focus, saying they were no longer certain that Moussa Oukabir had been the driver.
Instead, they pointed to Moroccan-born Younes Abouyaaqoub, 22, who lived in the town of Ripoll, 100km (60 miles) north of Barcelona. El Pais newspaper said there was a growing belief that Abouyaacoub was the main suspect.
The change in police attention came after it became clear that Moussa Oukabir was one of the five shot dead in the Cambrils attack. Two others named by police were Said Aallaa, 18, and Mohamed Hychami, 24.
Little is known of Moussa Ouakabir, although both brothers had Moroccan as well as Spanish nationality. He was from the northern Catalan city of Girona.
His brother Driss – who reportedly turned himself in, saying his documents had been stolen to rent the vehicles – was arrested in Ripoll on Thursday.
Catalonia’s Interior Minister Joaquim Forn, quoted by the Associated Press, said of the Barcelona attacker: “We had local police on the scene, but we were unable to shoot him, as the Ramblas were packed with people.”
Who else has been arrested?
Four others, all reportedly of Moroccan origin. One person from Spain’s north African enclave of Melilla was arrested on Thursday after an explosion in Alcanar, south-west of Barcelona, on Wednesday night.
Further arrests were made on Friday, including in Ripoll.
It remains unclear how many people were involved in the plots.
Why is the Alcanar explosion important?
Police are linking the Barcelona and Cambrils attacks to the blast Wednesday night that completely destroyed a house in Alcanar, 200km south of Barcelona, killing one person and wounding seven. The house was reportedly filled with bottles of propane and butane.
Police said on Friday that they believed the blast had thwarted plans for an even bigger attack.
“They were preparing one or several attacks in Barcelona and an explosion in Alcanar stopped this as they no longer had the material they needed to commit attacks of an even bigger scope,” said Catalonia police official Josep Lluis Trapero.
In another incident, a car was driven into officers at a checkpoint at Sant Just Desvern on the outskirts of Barcelona on Thursday evening.
They opened fire. A man was later found dead in the passenger seat of the car with stab wounds. The dead man is not linked to the Las Ramblas attack, officials say, but investigations are ongoing.
One theory is that the car was stolen and the man was killed by the carjacker, who is still at large.
Aftermath of Barcelona attack in pictures
Who are the victims?
They come from all over the world, with at least 34 nationalities represented.
People from Ireland, the UK, France, Australia, Pakistan, Venezuela, Algeria, Peru, Germany, the Netherlands, Greece, Hong Kong, Taiwan, Ecuador, the US, Argentina, Romania, Cuba, Austria and the Philippines are all reported to be among those hurt.
Read more about the victims
Francisco López Rodríguez, a 60-year-old from Granada, is the first Spanish victim to be named. Belgium said one of its citizens had been killed and Italy’s foreign ministry said two Italians had died.
US Secretary of State Rex Tillerson confirmed that at least one US citizen had been killed.
Father-of-three Jared Tucker, 43, was on honeymoon with his wife of one year, Heidi Nunes, when he died, his father said.
Mr Tucker had been enjoying drinks on Las Ramblas when the van struck him.
Canadian national Ian Moore Wilson, father of a Vancouver police officer, was also named as a victim. His wife, Valerie, was injured.
France said 26 of its nationals were injured, 11 seriously.
The Australian government said at least four citizens were injured, while a seven-year-old boy from Sydney is reported to be missing. Thirteen German citizens were wounded, some seriously.
A “small number” of Britons were injured, the UK’s Foreign Office said.
Who is responsible?
So-called Islamic State (IS) has said it was behind the Las Ramblas attack and that IS “soldiers” carried it out. But it did not provide any evidence or details to back up the claim.
The country is one of Europe’s most popular tourist destinations but in recent years has not seen the kind of jihadist violence that has rocked France, the UK, Belgium and Germany.
Still, Spain has been targeted before – several trains in Madrid, the capital, were bombed by al-Qaeda inspired militants in 2004, killing 191 people.
The IS news outlet, Amaq, said the attack was carried out as part of efforts to target states fighting in the US-led anti-IS coalition.
A few hundred Spanish soldiers are in Iraq, training local forces fighting the Sunni militant group.
How much jihadist activity is there in the country?
The number of operations carried out against jihadists has increased significantly since Spain raised its terror alert level to four out of five in June 2015, meaning there was a “high risk” of a terror attack.
Before these attacks, 51 suspected jihadists had already been detained in the country this year, while 69 were detained last year, and 75 were detained in 2015, according to El Pais.
Spain’s long anti-terror experience
Security and surveillance was stepped up in the wake of truck attacks in the French city of Nice in July 2016 and the German capital Berlin in December.
On Twitter, the Spanish royal household posted: “They are murderers, nothing more than criminals who are not going to terrorise us. All of Spain is Barcelona.”
How has the world reacted?
World leaders have offered support and message of solidarity.
British Prime Minister Theresa May said she was “sickened by the senseless loss of life in Barcelona”.
US President Donald Trump quickly condemned the attack on Twitter but has come under fire for invoking a debunked myth about a general who fought Islamist militants by using pig’s blood to commit mass executions.