Friday’s decision from the High Court granted Tsvangirai bail of 10 million Zimbabwe dollars (US $5,500 dollars) and ordered him not to make inflammatory comments after his release.
Tsvangirai is the leader of the main opposition party – the Movement for Democratic Change (MDC).
He was arrested on 6 June after a week of protests led by the MDC, which the government described as an attempted coup d’état.
Government lawyers were against bail for the former trade union leader, expressing concern that he would use his freedom to continue calling for Mugabe to be overthrown.
But High Court Judge Susan Mavangira told the courtroom that the state had not made its case against Tsvangirai.
"I've come to the conclusion that the state can strike a balance between the liberty of the accused person and the administration of justice," Mavangira said.
|President Robert Mugabe is facing|
his most vocal opposition in years
Tsvangirai was in another courtroom when the decision was reached. He is also standing accused of plotting to assassinate Mugabe.
His lawyers argued that Tsvangirai was being punished for advocating peaceful protest, and that his arrest was an attempt to silence him politically after this month's demonstrations, which the MDC called a "final push" against Mugabe's rule.
Treason carries a possible death sentence in the southern African country.
Zimbabwe is currently trying to contain its worst economic and political crisis since independence from Britain in 1980.
The once-prosperous nation is suffering chronic food and fuel shortages. Inflation has soared to 300 percent – one of the highest rates in the world.
The MDC argues that Mugabe has fatally mismanaged the economy, caused in part by the seizure of white-owned farms for redistribution to landless blacks.
It also says the 79-year-old president has stepped up political repression following his victory in a 2002 election that both the MDC and several western nations say was rigged.
Mugabe dismisses the claims and the MDC itself. But it is the most vocal opposition he has faced in more than two decades in power.
He describes the MDC as a puppet of Western governments opposed to his land reform programme, and says Zimbabwe is being undermined by both domestic and foreign enemies.