Thirteen people have been killed and dozens injured after a van hit crowds in the Las Ramblas area of Barcelona on Thursday evening.
The driver of the van fled and is still at large.
Spanish police later killed five suspected terrorists in the town of Cambrils to stop what they say was another planned vehicle attack.
The men, wearing explosive belts, were linked to the first attack, authorities say.
The situation in Cambrils – a popular seaside resort to the south-west of Barcelona – is now under control.
Police are also linking the Las Ramblas attacks in Barcelona and the incident in Cambrils with an explosion at a house on Wednesday evening in the town of Alcanar.
This third incident left one person dead, with police chief Josep Lluis Trapero telling reporters it appeared the residents at the Alcanar house had been “preparing an explosive device”.
Spanish prime minister Mariano Rajoy described the Barcelona attack as “jihadist”.
So-called Islamic State later said it had carried it out.
Rajoy announced three days of national mourning.
A minute’s silence will be held later on Friday.
Meanwhile police are continuing to search for the driver of the van used in the Barcelona attack, who fled on foot.
He is believed to be the sole attacker.
Tourists and locals fled when the rented vehicle sped down Las Ramblas in the centre of the city.
Photo copyright: Ralf Roletschek, via Wikimedia Commons, GFDL 1.2.
You can read more of the news on source