According to Fars, he told the court he did have links to the CIA, but had never intended to harm Iran.
"I was deceived by the CIA... Although I was appointed to break into Iran's intelligence systems and act as a new source for the CIA, I had no intention of undermining the country," Fars quoted him as saying.
Mr Hekmati's family, who live in Arizona, say the charges against him are fabricated and that he was in Iran to visit his grandmothers.
His father, Ali Hekmati, said his son joined the US military in 2001 and served in the Marines, where he was an Arabic translator.
The sentence comes at a time of heightened tensions between Iran and the West.
Tehran has threatened to close the Strait of Hormuz - a key route from the Gulf through which 20% of the world's traded oil passes - if the US and EU introduce further sanctions against Iran over its nuclear programme.
US defence chiefs on Sunday warned that they would take action if Iran closed the strait.
"That's another red line for us and ... we will respond to them," Defence Secretary Leon Panetta told CBS's "Face the Nation" programme.
"I was deceived by the CIA... Although I was appointed to break into Iran's intelligence systems and act as a new source for the CIA, I had no intention of undermining the country," Fars quoted him as saying.
Mr Hekmati's family, who live in Arizona, say the charges against him are fabricated and that he was in Iran to visit his grandmothers.
His father, Ali Hekmati, said his son joined the US military in 2001 and served in the Marines, where he was an Arabic translator.
The sentence comes at a time of heightened tensions between Iran and the West.
Tehran has threatened to close the Strait of Hormuz - a key route from the Gulf through which 20% of the world's traded oil passes - if the US and EU introduce further sanctions against Iran over its nuclear programme.
US defence chiefs on Sunday warned that they would take action if Iran closed the strait.
"That's another red line for us and ... we will respond to them," Defence Secretary Leon Panetta told CBS's "Face the Nation" programme.