Tymoshenko herself said she hoped the decision by the Strasbourg-based court would put paid to the "dirt and black lies" against her.
"The court considered that the detention had been arbitrary and unlawful during the entire period," the judges said.
The European Union is mulling a trade and association accord with the ex-Soviet republic and has clearly said it wanted Kiev to release the charismatic Tymoshenko.
Tymoshenko, who has rejected the charges against her as politically motivated, welcomed the ruling in a statement from jail.
Also Read
"I am happy all the dirt and black lies the authorities have been drowning me in over the past years have been removed," she said, asserting that the court had "de facto" acknowledged her as a political prisoner.
"After the decision of the European court I am already morally free. Free despite all their bars, cells, walls, fences and tinted windows," she said.
However they threw out a complaint over alleged ill-treatment during her transfer to hospital last year.
Tymoshenko, who lost a disputed presidential election to Yanukovych in 2010, was jailed for seven years on what she says are trumped-up charges of overstepping her authority while premier to sign a gas deal with Russia.
Western governments have condemned her jailing as the result of selective persecution by the authorities and it has led to a sharp deterioration in ties with the European Union, which Kiev wants to join.