Shahram Amiri was executed for giving "vital information to the enemy", a judiciary spokesman said.
Amiri disappeared in Saudi Arabia in 2009 and resurfaced a year later in the US, where he claimed to have been abducted and interrogated by the CIA.
He subsequently returned to Iran and was given a long prison sentence.
News of his execution emerged on Saturday, when Amiri's mother said the body had been handed over with rope marks around his neck.
On Sunday a spokesman for Iranian judiciary, Gholamhossein Mohseni Ejei, told reporters: "Through his connection with the United States, Amiri gave vital information about the country to the enemy,"
Amiri, who was born in 1977, went missing after taking a pilgrimage to Mecca.
After reappearing in the US in 2010, he said he had been kidnapped and put under "intense psychological pressure to reveal sensitive information".
However US officials at the time said Amiri had defected of his own accord and provided "useful information".
He initially returned to Tehran to a hero's welcome, but was later arrested and tried for treason.
Iran has long been suspected of seeking to develop nuclear weapons - an allegation it denies, saying it is pursuing civilian nuclear energy.
In January, Tehran reached a deal with foreign powers to curb its nuclear programme in return for the lifting of crippling economic sanctions.
An Iranian scientist who provided the US with information about the country's nuclear programme has been hanged for treason, the government has confirmed.