The governor was hauled into court last year to face trial on charges of insulting Islam while campaigning for re-election, in a case critics said was politically motivated.
The trial came after a series of major protests in the capital against the leader, known by his nickname Ahok, that drew hundreds of thousands onto the streets.
His once unassailable opinion poll lead shrank amid the controversy and he lost the race to lead Jakarta last month to a Muslim challenger.
The five-judge panel at the Jakarta court found Purnama guilty of blasphemy and jailed him for two years. Announcing the verdict, presiding judge Dwiarso Budi Santiarto said Purnama was "convincingly guilty of committing blasphemy and is sentenced to two years in prison" and ordered him to be detained.
Another judge, Abdul Rosyad, said reasons for the stiff sentence included that "the defendant didn't feel guilt, the defendant's act has caused anxiety and hurt Muslims".
Blasphemy carries a maximum jail term of five years in Indonesia but the verdict was a surprise as judges in Indonesia typically follow the recommendation of prosecutors in criminal cases.
Prosecutors last month urged judges to hand Purnama two years of probation, with a possible one-year jail term if he committed a crime during that period.
"I am disappointed and sad at the verdict," one of his supporters in court, Octa de Queljoe, told AFP. "It is very rare that a verdict is higher than what the prosecutors had asked for."
Outside the court, hundreds of Islamic radicals wearing white Muslim skullcaps celebrated as they heard about the jail sentence.
"Thank God, he should be jailed - this is right. He has insulted us," Bachtiar, 38, who like many Indonesians goes by one name, told AFP.
However some were unhappy Purnama did not receive the maximum sentence.
Source: AFP"We are upset - he should get more than that, he should get five years," said 46-year-old housewife Novareinita Zein.