Mr Lopez was found guilty of inciting violence during protests in 2014 in which 43 people – from both sides of the political divide – were killed.
He has repeatedly said that his sentence was politically motivated.
Thursday’s ruling on an appeal by Mr Lopez’s defence makes the conviction final, officials said.
“Under this dictatorship, every sentence is null,” said Mr Lopez’s wife, Lilian Tintori, as she arrived in Caracas following a meeting in Washington with Mr Trump.
“Trump is with the people of Venezuela,” she added.
On Wednesday, Mr Trump posted a photo of himself at the White House standing alongside Ms Tintori, writing on the social media site Twitter that Mr Lopez should be allowed “out of prison immediately”.
Before the tweet, Venezuelan President Nicolas Maduro had said that he did not want “problems with Trump”.
However Mr Trump’s remarks raised tensions and Venezuela’s Foreign Minister Delcy Rodriguez accused the US president of interfering in her country’s affairs.
Ms Rodriguez wrote on Twitter that she rejected “the meddling and aggression of US President @realDonaldTrump who tries to give orders in our fatherland”.
She also tweeted that Mr Trump had “sided with the boss behind violent acts” while Mr Maduro had proposed “initiating a new era of respectful relations” between the two.
Mr Lopez, who leads the Voluntad Popular (Popular Will) party, had earlier claimed through his defence team that 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.
His supporters insist that he is innocent and say he was jailed on trumped-up, politically-motivated charges.
Click here for original article.