In the Islamic republic, the crime of spying can carry the death penalty.
The pair stand accused of taking pictures of military sites, naval facilities and telecommunication posts on the southern island of Qeshm, a local judiciary official in the Gulf port city of Bandar Abbas was quoted as saying.
Their trial was held on Saturday in a Revolutionary Court, a tribunal which specifically deals with national security offences.
ISNA said that the two men, in the presence of their lawyers and Swedish diplomats, had acknowledged that they were photographing military installations.
The Swedish daily Aftonbladet has identified the men as construction workers from western Sweden. It said they were aged between 30 and 40.
Sweden’s charge d’affaires in Tehran, Sören Lundvall, also told Aftonbladet last month he had spoken to the men and that they were being treated well.
“They didn’t realise the severity of the photo ban,” Lundvall said.
The Swedish foreign ministry has said its embassy in Tehran was “working intensively” to secure their release.