Hundreds of thousands of people in Barcelona have marched against militant Islamists who left 15 people dead in and around the city last week.
King Felipe VI led the demonstrators, alongside Prime Minister Mariano Rajoy.
The king is the first Spanish sovereign to take part in a demonstration since the monarchy was re-established in the 1970s.
Emergency workers and shop staff who helped during the attack at Las Ramblas also took pride of place.
The procession set off behind a banner bearing the slogan “I’m not afraid”. Other placards denounced Islamophobia.
During the march, the king and prime minister walked the streets in front of hundreds of Catalan flags – the emblem for the autonomous region’s long-running independence claim.
Some protesters whistled and shouted “out” at the king.
Catalonia, of which Barcelona is the capital, is due to holds its unrecognised independence referendum in October.
Prime Minister Rajoy had encouraged “everyone” to take part to show that “Catalonia and the rest of Spain [are] united against terror”.
The 17 August attack – which saw a van deliberately driven into people on the Las Ramblas boulevard – was claimed by the Islamic State group.
The driver later stabbed and killed a man while hijacking his vehicle. Hours later, a car attack in nearby Cambrils killed another woman.
King Felipe has reigned in Spain since 2014, when his father, King Juan Carlos I, abdicated.
Spain’s monarchy was restored after the death of military dictator Francisco Franco in 1975.