Here is a timeline of how events unfolded in Alcanar, Barcelona and Cambrils.
:: Wednesday night - One person is killed in an explosion in Alcanar, which authorities believe is linked to the Barcelona van attack.
:: 5pm - A white Fiat van speeds through Las Ramblas, a busy street in Barcelona. At least 13 people are killed and more than 100 others injured as the driver ploughs into the crowds along a 500m stretch of the pedestrianised area. The driver then flees, leaving a scene of widespread panic, with people running in waves away from the area.
:: 7pm - In a tweet before 7pm, Catalonia's police force says the protocol for terrorist attacks has been activated.
:: 8pm - Two men are arrested in connection with the incident. One is named as Driss Oukabir, a 28-year-old Moroccan who is believed to have rented the van.
:: 8.40pm - The Islamic State terror group claims responsibility for the attack.
:: 1am - Seven people are reported injured when a group, said to be wearing "explosive belts", launch a van attack in the coastal town of Cambrils, similar to the one in Barcelona. Footage posted on social media, which appears to have been filmed on the town's beachfront promenade, shows bystanders running for cover and several gunshots are heard. Spanish police shoot four suspected terrorists dead and injure another.
:: 3am - Police say the fifth suspect has died.
:: 8am - Spanish police arrest a third person in Ripoll, and tweet that the belts worn by the five men shot dead in Cambrils were "simulated explosives".