He was found guilty of inciting violence during protests in 2014 in which 43 people – from both sides of the political divide – were killed. 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.
The court ruling was revealed by Lopez’s Voluntad Popular (Popular Will) political party and later confirmed by his lawyers.
His defence 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 defence. Several other opposition leaders have also been held in detention and their fate has divided opinion in Venezuela.
The US government and the United Nations have called for their release. Reacting to the court verdict, US Assistant Secretary of State for Western Hemisphere Affairs Roberta Jacobson said she was “deeply concerned” by the conviction.
She also urged the Venezuelan government to “protect democracy” in the country. For many poorer Venezuelans, Lopez is seen as a dangerous figure who incites violence and coups against the government and who is out of touch with the needs of most ordinary people.
His critics point to his involvement in 2002 in a failed coup attempt against late President Hugo Chavez. But his supporters say he is a scapegoat for current President Nicolas Maduro during the country’s economic crisis that has led to shortages of basic goods.