People who tended the victims of the attack were given pride of place at the front of the procession behind a large white- and-black banner that read "No tinc por" -- Catalan for "I'm not afraid".
They included uniformed police officers, doctors in their white coats, firefighters wearing their helmets and residents and shop owners who rushed to help after a van struck people on the Las Ramblas avenue, as well as taxi drivers who transported people free.
"Its good that people see that we are the front of march and that we are no afraid," said Barbara Cabello, 22, who works at one of the flower stands on Las Ramblas, a symbol of the city.
The marchers carried red, yellow and white flowers -- the colours of Barcelona -- as they made their way along the city's main boulevard, the Paseo de Gracia, to the Plaza de Catalunya, near where the attack took place.
"No to Islamophobia" and "The best response: Peace" were among the signs on display at the march, which was broadcast live on Spanish public television.
The Mediterranean city is in mourning after a driver ploughed into crowds on Las Ramblas on August 17th, followed hours later by a car attack in the seaside resort town of Cambrils.
Fifteen were killed in the carnage and Spanish Prime Minister Mariano Rajoy had called on Spaniards to turn out in force to show their "love" and solidarity with Catalonia.
The march will "once again give a clear message of unity and condemnation of terrorism, and of love for the city of Barcelona,", Rajoy said on the eve of the demonstration.
King Felipe VI marched along Prime Minister Mariano Rajoy and representatives of all of Spain's major political parties behind the first ranks.
He is the first Spanish sovereign to take part in a demonstration since the monarchy was re-established in 1975 after the death of dictator General Francisco Franco.
But both the king and Rajoy were jeered as they arrived at the march by Catalan separatists, who reject the monarchy and hope to set up an independent republic.
In the aftermath of the attacks, however, which were claimed by the Islamic State group, Rajoy and Catalonia's separatist president Carles Puigdemont have made a show of unity.
Spain's King Felipe VI (C) stands between Spanish Prime Minister Mariano Rajoy (L) and President of Catalonia Carles Puigdemont (R). Photo: Lluis Gene/AFP
Europe has been shaken by a series of deadly Islamist violence, with an increasing number of low-tech attacks using vehicles or knives – sometimes both -- as weapons.
On Friday evening, a man was shot dead in central Brussels after stabbing a soldier while shouting "Allahu akbar" (God is greatest), and shortly afterwards a man with a large knife attacked police in London as they tried to arrest him outside Buckingham Palace.
Already on Friday evening, thousands of people had marched against terror in Cambrils.
Saray Gomez, an 18-year-old who works at a flower stall right next to where the van ended its murderous assault, said it was important "to give a message of unity and peace."
"And it's important to distinguish between Islam and jihadists, because Muslims are the first to be affected."
A muslim man holding a Spanish flag and a placard reading "I am Muslim, this criminal group does not represent us" shakes the hand of a woman during the march. Photo: Pau Barrena/AFP
When the march arrived at Plaza de Catalunya near Las Ramblas, two cellists played "Cant dels ocells" (Song of the birds), a traditional Catalan melody which has become a symbol of peace.
It was famously played by the celebrated cellist Pau (Pablo) Casals, an outspoken opponent of the Franco regime, at the White House in 1961.
Marches were also held in cities around Spain, including Madrid, Valencia and Vigo.