The march was organized on social media with the hashtag #NoTincPor
-- Catalan for "I am not afraid" -- a slogan shouted repeatedly by the protesters as they made their way down the Passeig de Gràcia shopping avenue.
Spanish King Felipe VI and Prime Minister Mariano Rajoy attended the protest, which was also a show of Barcelona's unity and cultural diversity. Protesters held signs saying "No to Islamophobia" as they marched alongside members of the city's Muslim community.
Some Muslim marchers held signs reading "I am Muslim. I am not a terrorist," and "Islam is peace."
"The solution is peace. Peace is equal for all," one protester told CNN Espanol.
Another woman in the crowd looked dejected and said simply, "it's enough already."
Marchers handed roses to the police and paramedics to thank them for their response to the attacks, and some adorned their vehicles with the flowers.
The Catalan Police confirmed that around 500,000 people attended the protests. On its Twitter account, police posted pictures of the march
and wrote: "Today there is only one message and it is the rejection of terrorism. Respect all cultures and let's say #Imnotafraid #NoTincPor."
Protesters also added their tributes to a mountain of roses laid at Las Ramblas, where a driver plowed a van into crowds on August 17, killing 14 people and leaving more than 100 others injured.
The death toll from the Barcelona attack rose from 13 to 14 on Sunday, when the Catalan government announced that a 51-year-old German woman had also died from her injuries. The government did not name the woman.
Police believe 22-year-old Morrocan national Younes Abouyaaqoub was the driver in the attack. He is also accused of killing a man as he hijacked a vehicle to escape the attack scene. Abouyaaqoub was killed during a police operation on Monday.
Another victim died in a second attack in the early hours of August 18, when a vehicle mowed down pedestrians in the coastal town of Cambrils. Five assailants in the car were shot dead by police at the scene. They and Abouyaaqoub were wearing fake suicide belts when they were killed, police said.