The sentence is harsher than prosecutors had called for as they had reportedly recommended two years of probation, AP reports. About 85 percent of its population are Muslim, but the country officially respects six religions.
Outside the court in north Jakarta, supporters of Ahok wept and hugged each other amid shouts of jubilation from members of conservative Islamic groups.
A five-judge panel found Ahok "legally and convincingly" guilty of blasphemy.
Nearly no one who has been charged under the blasphemy law has ever escaped conviction, associate professor of Indonesian politics at the Australian National University Greg Fealy told CNN.
United States to equip Kurdish fighters in Syria
There was no immediate reaction from Turkey, whose president, Tayyip Erdogan, is expected to meet Trump in Washington next week. Kurdish forces have always been considered among the most reliable groups in the fight against ISIS.
Earlier in the morning, they had danced to music and laid out thousands of red and white roses in support of the outgoing governor and as a show of unity towards Indonesia.
The lead judge, Dwiarso Budi Santiarto, said the trial was a purely criminal one and that the court disagreed that there were political aspects to the case.
The court's decision comes as a surprise to many, given prosecutors had only called for downgraded charges and the much lighter punishment of a year's suspended sentence on charges of hate speech.
His once unassailable opinion poll lead shrank amid the controversy and he lost the race to lead Jakarta last month to a Muslim challenger, a result that fuelled fears of Indonesia's moderate brand of Islam coming under threat from increasingly influential radicals.
Monday playoff to decide tourney
Blixt, Kisner, and Brown all played safely and found the short stuff with their second shots and Smith found a green side bunker. Foursomes: Teams of two compete with one ball per team, taking alternate shots until the hole is completed.
On the day of the election, the Jakarta Post editorial board described the campaign as the "dirtiest, most polarizing and divisive" ever seen in Indonesia. Several major demonstrations were organized on the streets of Jakarta between October 2016 and May 2017 in which Islamic hardliners urged the government to arrest Ahok. Purnama enjoyed popularity as the governor of Jakarta.
Tobias Basuki, an analyst from Jakarta think-tank the Centre for Strategic and International Studies, said the shock decision could have been driven by pressure from Purnama's political foes on the notoriously corrupt judiciary to remove the governor from power as soon as possible.
The charge related to a reference by Basuki Tjahaja Purnama - better known by his nickname Ahok - to a Quranic verse in his re-election campaign last September. "What I said to the local people of Thousand Islands is that if you are fooled by racists and cowards using that verse in the Quran not to vote for me, then don't vote for me".
Critics want the country's blasphemy laws overhauled. The legislation was rarely used during the 32-year rule of strongman Suharto, but in recent years has been exploited to persecute minorities, rights groups say.
Always Dreaming captures 143rd Kentucky Derby
Some have not only their favorite picked out at Will Rogers Downs but also who they're rooting for in the 143rd Kentucky Derby. It was the second Derby triumph for jockey John Velazquez, Pletcher's top rider.