Outside the court in the capital, Khartoum, the men's families rejoiced and sang, AFP news agency reports.
Yat Michael and Peter Yen Reith had faced a possible death sentence if convicted.
Sudan has a majority Muslim population governed by Islamic law, and Christians often complain of persecution.
Last year there was global condemnation when a Sudanese woman was sentenced to hang for apostasy - renouncing her religion - after marrying a Christian man.
Her sentence was overturned by an appeals court and she is now living in the US with her husband.
"I am feeling free because I was in jail for many months," Mr Michael told the Christian Solidarity Worldwide advocacy group after his release. He added that he felt as though he was "born again".
He was taken into custody last December after delivering a sermon in the capital.
His colleague, Mr Reith, was arrested the following month when he came to look for the clergyman.
The two, who belong to the South Sudan Presbyterian Evangelical Church, were found guilty of other minor charges.
Mr Michael was convicted of disturbing the peace and Mr Reith for participating in a criminal organisation.
"The sentence they served in prison is enough, release them immediately and return the mobile phones and laptops," Judge Ahmed Ghaboush is quoted by AFP as saying.
BBC Sudan analyst Mohanad Hashim says many in Khartoum believe the spying charges were fabricated and that the real battle with the authorities is over land.
Government officials want churches in the city to give up some of the vast tracts of land they own so that it can be used for investment, he says.
Churches have been reluctant to part with the land, even though their position has been weakened since South Sudan became independent in 2011.
A court in Sudan has freed two South Sudanese Christian pastors after acquitting them of charges that include spying and crimes against the state.