Shane Bauer and Josh Fattal were arrested along with another American, Sarah Shourd, on the unmarked border between Iran and Iraq in July 2009.
The trio had claimed they were hiking in Iraq's northern province of Kurdistan when they innocently strayed into the Islamic republic.
Bauer and Fattal, both 28, were each sentenced to three years in jail for "illegal entry" and five years "on charges of espionage for the American intelligence agency".
It is not clear whether that includes time already served. The pair have 20 days to appeal the sentence.
They had pleaded not guilty to the charges.
The Americans said they mistakenly crossed into Iran when they stepped off a dirt road while hiking near a waterfall.
The US government has appealed for the pair to be released, insisting they have done nothing wrong.
Shourd, 32, was tried in her absence after she was freed on humanitarian and medical grounds on $500,000 bail last September.
She returned to the US and Iran state TV has said her case was "still open". Source