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 Kingdom mulls clean-air zones, scrappage scheme for polluting vehicles
The plans are now open for public consultation until 15 June, ahead of the final air quality plan's publication on 31 July. But the Tories ruled out "hitting motorists in the pocket" by imposing charging zones and increased parking charges.
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.
Indians ace Kluber leaves game with back discomfort
This was Almonte's first start in center field this year, and that play was the only one which presented any challenge for him. On a cold, damp night, he left Detroit's 5-2 win over the Cleveland Indians for a defensive replacement after seven innings.
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.
Police officer who fatally shot Jordan Edwards is fired
Balch Springs police said Tuesday evening that the district attorney's office will decide whether Oliver will be charged.