At least 80 people also wounded after vehicle mounts pavement in busy Las Ramblas area of Catalan city.
Separate attacks have taken place in Spain’s Catalonia region. Here is what is known so far.
On Thursday at 4:50 pm local time (14:50 GMT), a white van ploughed into a crowd of pedestrians.
Witnesses said the vehicle zigzagged at high speed down Las Ramblas, ramming pedestrians and cyclists. The van knocked many to the ground and sent others fleeing for cover in shops and cafes.
Witnesses described scenes of chaos and panic with bodies strewn along the boulevard.
Eight hours later in Cambrils, a black Audi A3 sedan hit more pedestrians.
Five attackers, some of whom appeared to be wearing suicide belts, were shot dead by police. Authorities later confirmed the explosive belts were fake.
Both the Las Ramblas and Cambrils attacks are believed to be linked.
The first attack took place in Las Ramblas, a famous boulevard in central Barcelona, a 1.2km stretch of shops and restaurants usually heaving with tourists.
The second attack took place in the popular seaside resort town of Cambrils, 110km south-west of Barcelona.
— Al Jazeera English (@AJEnglish) August 17, 2017
Amaq said ISIL had launched the attack in response to calls to target states taking part in the United States-led coalition battling the group in Iraq and Syria.
Younes Abouyaaqoub, a 22-year-old, was identified as the driver in the deadly van attack.
Regional Interior Minister Joaquim Forn said at least 14 people had died in the first attack and more than 100 were injured.
There were at least 18 nationalities among the Barcelona victims who came from countries as varied as France, Venezuela, Australia, Ireland, Peru, Algeria and China, according to Spain’s civil protection agency.
On Wednesday night, an explosion destroyed a house in the town of Alcanar, 200km south of Barcelona, killing one person and wounding seven.
Residents of the house were preparing explosives using gas cylinders, a Catalan police source told Reuters news agency.
Police shot Abouyaaqoub near Subirats, west of Barcelona, on August 21, after being alerted to the presence of a suspicious man.
The other suspects thought to be behind the attack have been arrested, shot by police or killed in the explosion.