Crowds filled a central Madrid square and activists marched the streets of Almeria and the northern city of Coruña, where the crime happened, chanting slogans and waving rainbow-coloured flags.
Similar demonstrations were held in other cities over the weekend, including Barcelona and Seville.
Samuel Luiz, a 24-year-old nursing assistant, was beaten unconscious near a nightclub in Coruna in the early hours of July 3 by several assailants. He died later in hospital.
The attackers shouted homophobic slurs while beating Luiz, according to his friends’ version of events.
Police have so far arrested six suspects, including two minors, over the killing but the authorities have said they are still working to determine if the attack was motivated by homophobia.
Miguel Serrano, 22, said he joined the demonstration in Madrid “because it could have been me” in Luiz’s place.
“It is clear it was a homophobic attack because of the insults that were hurled,” he added.
Protesters carried signs reading: “Some people are LGBTQ+. Get over it” and “We are all Samuel. Justice now!”.
Socialist Prime Minister Pedro Sanchez condemned the killing, calling it a “savage and merciless act” in a tweet, as have Latin pop star Ricky Martin and Spanish singer Alejandro Sánz.