On the day he turned 56, Thursday, John Pombe Magufuli also became Tanzania's president-elect, winning 58.46 per cent a hotly contested vote, according to final results announced by the National Electoral Commission.
Mr Magufuli, the candidate of the ruling Chama Cha Mapinduzi party, collected 8,882,935 votes in an election that registered a lower-than-expected turnout of 67 per cent.
Thousands of cheering supporters massed at the CCM headquarters in the commercial capital Dar es Salaam on Thursday afternoon after the announcement was made.
"This is a great and very important day in my life," Mr Magufuli said on Twitter. "It is my birthday and I have been given the mandate to lead the Tanzania people as the president."
He replaces Mr Jakaya Mrisho Kikwete who is stepping down next month after serving his two maximum terms allowed under the law and his win continues CCM's grip on power in Tanzania, in various guises, since Independence in 1961.
The opposition Chadema party, whose candidate Edward Lowassa came second with 39.97 per cent, declined to sign the consent forms following earlier claims of fraud and calls for a recount of the tightly contested election. Chauma, a smaller opposition party whose candidate got 0.32 per cent of the vote, also refused to sign the forms.
Mr Lowassa Thursday rejected the results announced by NEC and said they did not tally with what had been announced at the polling stations. The opposition candidate had earlier called for a recount of the votes and condemned the state for raids on Chadema's independent tally centres on Sunday night that left them crippled with three opposition officials in custody facing charges.
In a public statement, Mr Lowassa said his party tally showed he had won the election with 10.2 million votes, or 62 per cent, and called on NEC to declare him the winner. "We strongly believe that tampering with the people's democratic right is in essence the creation of turmoil," he warned.
There was no immediate response from NEC officials.
Under Tanzanian law disputes arising out of presidential elections are heard by the NEC and not the court, and it was not immediately clear what options were available to Mr Lowassa in light of his loss of confidence in the electoral body.
The integrity of the exercise was thrown into question on Wednesday after the Zanzibar Electoral Commission annulled presidential and parliamentary elections on the islands over allegations of fraud.
The move came after the candidate of the opposition Civic United Front, Seif Sharif Hamad declared himself winner of the presidential election on the islands, ahead of incumbent Dr Ali Mohamed Shein of CCM, which has governed Zanzibar since independence.
In a joint statement issued Thursday, foreign election observers, who had all praised the peaceful nature of Election Day, expressed concern about the annulment of the Zanzibar result and called for a speedy resolution of the stalemate.
The annulment by Zanzibar Electoral Commission chairperson Jecha Salum Jecha followed dramatic scenes on Tuesday night when soldiers surrounded the hotel where the vote tallying was being conducted and ejected journalists and election observers.
Change of guard
A holder of a PhD in chemistry, Mr Magufuli was a Cabinet minister in charge of public works in the second Kikwete administration from 2010 but he was a surprise CCM choice for the presidential candidature. He emerged as a compromise candidate after Mr Kikwete refused to back Mr Lowassa, his erstwhile ally and former prime minister who was forced to resign in 2008 at the height of a major corruption scandal.
After defecting to the opposition, Mr Lowassa was expected to give the upstart CCM candidate a stiff challenge but in the end Mr Magufuli held his own. In an election that was in part a referendum on the Kikwete decade in power and a ruling party many see as old and in need of reform, the president-elect ran mostly on his personal attributes of being an honest hard worker and only made references to CCM sparingly.
His win means that in Suluhu Samia, his running mate, Tanzania has also elected its first-ever female vice president. The 55-year-old native of Zanzibar is a former MP and State minister in the presidency who previously spoke of being "looked down upon" by male colleagues because of her gender.
Just over 23 million voters were eligible to cast their ballots in Tanzania's fifth General Election since returning multiparty politics in 1992 but the turnout of 67.31 per cent, while much higher than the 44 per cent in 2010, was lower than expected.
It appears to have hurt opposition chances with Mr Lowassa winning less than a quarter of all the constituencies according to official results, and with a smaller margin in his strongholds than the CCM candidate.
The president-elect will be sworn in on November 5.