The 44-year-old had been held in a military prison since February 2014.
While the court verdict was being awaited, fighting broke out between his supporters and pro-government activists outside the courthouse in Caracas.
Lopez`s supporters said one of their number had suffered a heart-attack during the disturbances.
`Rights violated`
The court ruling was revealed by Lopez`s Voluntad Popular (Popular Will) political party and later confirmed by his lawyers.
His defense team earlier said there had been serious irregularities in the trial, with the judge hearing 138 witnesses for the prosecution but only one of the 50 witnesses and pieces of evidence submitted by the defense.
His family says he has been in solitary confinement for most of his 19 months in prison and that his human rights have been violated.
More about: