Prime Minister Theresa May has said the UK "stands shoulder to shoulder with Spain in confronting and dealing with the evil of terrorism".
She said she had "offered any assistance we can provide" to Spain after the attacks in Catalonia.
She also confirmed that British nationals were caught up in the attacks and the UK was looking into reports of a missing child with dual nationality.
Labour leader Jeremy Corbyn said was "shocked and appalled" by the attacks.
The Spanish flag and the union jack are flying at half mast in Downing Street and at other government buildings.
Officials in Barcelona say at least 13 people were killed and more than 100 hurt when a van ploughed into pedestrians on Las Ramblas. Police later shot dead five suspects after a second vehicle attack, in which a woman who was injured later died..
The Foreign Office has issued advice to tourists to take care and follow the advice of local security authorities.
A Foreign Office spokeswoman said it had "deployed additional staff to Barcelona" and "offered support to the Spanish authorities".
Speaking from her Chequers country residence, Mrs May said countries must "work together if we are to confront this evil of terrorism" and the "perverted, extremist ideology which drives it".
She stressed the importance of ridding the internet of "poisonous material", adding that terrorism was "the great threat that we all face" and vowing that "together we will defeat it".
Labour leader Jeremy Corbyn said he had been "appalled" by "the terrible loss of life, people innocently down Las Ramblas just enjoying themselves and somebody does this unbelievable act, which has taken the lives of many".
He added: "Obviously our sympathies to the families of all those who have lost ones and to all those that are injured, and thank you to the authorities in Spain for reacting so quickly."
Boris Johnson, the foreign secretary, also expressed his condolences on Twitter. "Concerned and saddened by #Barcelona attack. Our thoughts are with those affected. Doing all we can to identify whether Brits need help," he wrote.
Plaid Cymru Leader Leanne Wood has sparked a row with comments on Twitter suggesting far-right ideologies drove both IS and white supremacists.
Following the attack on Thursday, Ms Wood tweeted: "Ofnadwy / terrible. Is this more far right terrorism? My thoughts are with all those affected."
She added: "All forms of political violence are the same. USA, Barcelona, everywhere. They are ideology-driven & we have to understand that to stop it."
The Welsh Conservatives called on Ms Wood to apologise or resign, while UKIP accused her of an "outrageous smear".
The Plaid Cymru leader said she was "staggered" by the response to her comments but stood by them, saying "politics and ideology lie behind these acts of violence," and adding: "My thoughts are first and foremost with the victims of last night's horror."
Sadiq Khan, the mayor of London which has seen two similar vehicle attacks in recent months, tweeted his thoughts were "with the victims of this barbaric terrorist attack in the great city of Barcelona".
"London stands with Barcelona against the evil of terrorism," he added.
All of Europe stands with #Barcelona. Our thoughts are with the victims and all affected by this cowardly attack on innocents.— Donald Tusk (@eucopresident) August 17, 2017
Conservative MP Sir Greg Knight, secretary of the British-Spanish all-party parliamentary group, tweeted: "Pleased the PM has said Britain stands with Spain against the evil of terrorism."
Lib Dem leader Sir Vince Cable tweeted: "Shocked to see another #TerroristAttack this time @barcelona. Every sympathy for victims with many injured."
EU officials also condemned the attack. European Council President Donald Tusk tweeted: "All of Europe stands with #Barcelona. Our thoughts are with the victims and all affected by this cowardly attack on innocents."
European Commission President Jean-Claude Juncker tweeted: "My thoughts are with the people of #Barcelona. We will never be cowed by such barbarism."