Mohammad Ali Dadkhah also said that the opposition figure was handed a five-year ban on civic activities.
The 80-year-old Yazdi, who heads the banned Freedom Movement, was put on trial on security charges, including acting against national security and spreading lies. Similar charges have often been brought against political activists in Iran.
Yazdi had refused to defend himself because he said he didn't recognize the Revolutionary Court's legitimacy to put him on trial and review the charges against him.
Yazdi has been in and out of prison in Iran over the past two decades. He was jailed in Iran last year and also following the 2009 postelection crackdown.
One of the main reasons for the sentence against him is reportedly his leadership of the Freedom Movement. Yazdi's open letter to Rachid Ghannouchi, the leader of the Tunisian Islamist party Ennahda, in which he warned about a repeat of the Iranian experience, is also said to have angered hard-liners.
In the October letter, Yazdi warned that Muslims don't have enough experience with democracy.
"The result is that we Muslims overthrow despots often to see a new ones replace it. This is what has indeed befallen us in Iran. We deposed the shah, but neglected to address the 'shah' personality within our own selves. Thus the vicious circle continues."
Yazdi's son in law, Mehdi Nourbakhsh, told RFE/RL the opposition activist was suffering from prostate cancer and other health problems and was in need of constant medical care.
"Last time he was in jail he had to be transferred to the hospital several times" because of his health problems, Nourbakhsh said. "At his age and under these conditions I think what the establishment is doing to [Yazdi] is extremely unjust , unfair, and cruel."