Marin Eugen Sabau, 46, shot and injured three former colleagues and a police officer in the north-eastern city of Tarragona in December.
After being shot in the spine and left partially paralysed, he had begged to be euthanised rather than face trial.
Courts approved the request despite appeals from victims.
Sabau, who was originally from Romania, carried out the attack at the security services company he used to work for in December.
He escaped the scene, and barricaded himself in a house filled with an arsenal of weapons. After shooting and wounding a police officer, security forces cornered him and shot him several times, Observator news said.
He had one leg amputated after the shoot out, and was also left paralysed and unable to move. He said his injuries left him in chronic pain and it was ruled that he met the requirements to request an assisted death.
A law – passed in Spain last year – states that adults with serious and incurable conditions that cause “unbearable suffering” can choose to end their lives.
But victims of the shooting opposed the request, arguing that Sabau should be brought to justice.
A court in Tarragona, however, ruled that it was Sabau’s fundamental right to request euthanasia considering his circumstances and stated that in line with the law, the judicial system had no right to interfere.
Reacting to the ruling, the lawyer of the police officer who was injured by Sabau said the court had squandered the opportunity to rule on a unique case.
“It was not about preventing euthanasia, but we did want the victims to have a fair trial,” lawyer José Natonio Bitos was quoted in El País as saying.