He was detained in Sant Cugat del Valles on the outskirts of the Mediterranean coastal city, just hours after a homeless person was found murdered in the centre, Catalonia's regional police force, the Mossos d'Esquadra, said in a statement.
The dead body showed signs of a violent death and was found “in the same area where other deaths of the homeless were recorded in recent weeks,” a spokeswoman for the force added.
?? Under arrest a man for the relationship with the series of violent deaths during the last weeks of sleeping rough in Barcelona
— Mossos (@mossos) April 28, 2020
The man had suffered a blow to the head, as did the other suspected victims, news radio Cadena Ser reported.
Police said they had identified the suspect with the aid of descriptions provided by witnesses and security camera footage.
“The way this person behaved did not leave his victims any way to defend themselves. The violence was excessive and gratuitous,” the officer in charge of the investigation, Joan Carles Granja, told a news conference.
“These homicides on the streets of homeless people have ended,” he added.
The suspect, who was not named, had previously been arrested for theft in Zaragoza, 250 kilometres (155 miles) west of Barcelona.
“He was a bit incoherent, we don't rule out that he has some mental problem,” Granja said.
The streets have been largely deserted since the Madrid government imposed a lockdown on March 14, with people allowed outside only to go to work if they can't work from home, to buy food and medicine and briefly walk their dog.
Like other Spanish cities, Barcelona set up shelters for the homeless during the lockdown but many have preferred to continue to live on the streets.
Four homeless people have been killed in Spain's second city since March 19th. Three were murdered in the last two weeks, all suffered blows to the head.
Local media said one of the deaths was linked to a fight between homeless people.