The men, all Azerbaijani citizens, were given sentences ranging from 10 to 15 years in prison after being accused of planning attacks in cooperation with Iran’s Revolutionary Guards.
Some of those jailed were residents of the village of Nardaran, a stronghold of Muslim activism near the Azerbaijani capital.
When the men were arrested in May, Azerbaijan’s security services said they seized weapons, explosives and espionage equipment.
The national security ministry said that the alleged plotters had received weapons and spy training at military camps in Iran after being recruited from 1999 onwards.
The ministry said the suspects had spied on diplomatic missions and foreign companies including British oil company BP-Azerbaijan’s office.
Tensions between Iran and mainly Muslim but officially secular Azerbaijan have risen over the past year, with a series of arrests in Baku of attack plot suspects with alleged links to Tehran.
Iran has also been angered by Azerbaijan’s friendly ties to Israel and the United States.
The uneasy relations between the neighbors are complicated by the presence of a huge ethnic Azeri minority in Iran, which far outnumbers Azerbaijan’s own population of 9.2 million.