The Strasbourg-based European Court of Human Rights upheld its previous ruling in favour of releasing Inés del Río Prada, a 55-year-old jailed member of the armed Basque separatist group.
The decision could lead to the Spanish courts ordering the release of scores of other prisoners in the same situation as Del Río, who has been in jail since 1987 after being sentenced to 3,838 years for terrorist-related offences including 19 killings.
The European court had ordered Del Rio Prada's release in July 2012 but agreed to a request by the Spanish government to re-examine the case.
However, in its ruling , the human rights court said Spain should "ensure that the applicant was released at the earliest possible date".
It also told Spain to pay her €30,000 ($41,000) in damages and €1,500 for costs and expenses.
The court ruled against Spain over a legal practice known as the "Parot doctrine" that allowed the time convicts spend in prison to be extended retroactively.
The doctrine, adopted by the Spanish Supreme Court in 2006, said that years of remission earned through prison work should be deducted from the total sentence — often amounting to hundreds of years — instead of the 30-year limit on prison terms set by Spanish law.
In del Río's case, the new doctrine wiped out her remission and extended her prison time by nearly nine years.
The same doctrine affected 54 ETA prisoners, nine prisoners from other armed groups that have since been broken up, and 14 common criminals, according to Spain's Interior Ministry.
It was first applied in February 2006 to ETA prisoner Henri Parot.
ETA, listed as a terrorist group in the United States and Europe, is blamed for the deaths of 829 people in a four-decade campaign of shootings and bombings for an independent homeland in northern Spain and southern France.
Many of its leaders have been arrested in recent years.
In October 2011, ETA declared a "definitive end to armed activity" but it has not formally disarmed nor disbanded as the Spanish and French governments demand.