The man had begged for the right to die but victims of the shooting had argued that he should face justice.
Prison authorities in Spain have euthanised a gunman who was left paralysed after a shootout with police.
Marin Eugen Sabau died on Tuesday evening after an unprecedented court decision did not oppose his request for euthanasia.
The 46-year-old Romanian security guard shot three colleagues and a police officer in December in the northeastern city of Tarragona. Several others were injured in the chase.
He was detained by police after officers shot him in the spine in an abandoned farmhouse, leaving him with an irreversible spinal injury and one leg amputated. No one was killed in the shooting.
Sabau said he carried out the shooting spree because he was suffering "hell" at work and accused his bosses of racism.
Since December, he has been bedridden at the Terrassa prison hospital near Barcelona and had demanded the right to die. A Tarragona court judge ruled in his favour earlier this month, ruling that he had a "fundamental right" to "dignity".
"Spanish law does not specifically regulate euthanasia in the case of persons in pre-trial detention or subject to legal proceedings," the judge said.
The law allowing euthanasia in Spain came into force last year for adults with serious and incurable conditions that cause "unbearable suffering".
The case of the so-called "Gunslinger of Tarragona" has divided Spain, as lawyers for Sabau's victims had called for him to go to trial to receive compensation.
"The victims have a feeling of frustration, a person was left to decide when and how to end the legal proceedings," said José Antonio Bitos, the lawyer for two injured policemen injured.
"We were not opposed to euthanasia per se, but to the fact that it took place before the trial," he told AFP.
Bitos added that his clients would receive damages from Spain's public administration because they were injured on duty, while other victims "will not get a trial or compensation".
He noted that the decision weakens the rule of law in Spain and could set a precedent for other serious crimes, including terrorism or paedophilia, and has called for the law on euthanasia to be updated.
The judge in Tarragona did reject a request from Sabau's family that he be allowed to die in a normal hospital.
Spain's Constitutional Court had refused to judge Sabau's case, stating that there had been no violation of fundamental rights.