Joko "Jokowi" Widodo was declared the winner of Indonesia's presidential election on Tuesday, bringing the promise of major reforms to the world's third largest democracy.
The Elections Commission, known as KPU, said the Jakarta governor had won by just over six percentage points, with 53.15 percent of the nearly 130 million votes cast on July 9.
It was the closest and most bitterly fought election in Indonesia's history, pitting Jokowi against former general Prabowo Subianto, whose promise of strong leadership brought echoes of decades under autocratic rule.
"This victory is a victory for all the people of Indonesia," the president-elect told hundreds of supporters gathered at a port on the outskirts of the capital Jakarta, chosen to emphasize his commitment to Indonesia's maritime potential.
He and his vice president-elect, Jusuf Kalla, arrived by speed boat.
"With humility, we ask the people...to go back to a united Indonesia," he added.
In an interview with Reuters before the result was announced, Jokowi promised to simplify life for investors by beefing up the country's threadbare infrastructure, unravel near impenetrable regulations and sack ministers if they were not up to the job.
The United States, which sees Indonesia as an increasingly important partner in Asia in the face of growing Chinese power and assertiveness, was quick to offer congratulations.
U.S. Secretary of State John Kerry said bilateral ties had strengthened to the point where the two countries "can jointly address common regional and global challenges."
"The United States looks forward to working with President-elect Widodo as we deepen our partnership, promote our shared objectives globally, and expand people-to-people ties between our nations," Kerry said in a statement.
Jokowi's can-do approach, impatience with bureaucracy and willingness to communicate directly with ordinary people has won him a huge following in a country where close to 40 percent of the population live below or close to the poverty line.
When he moves into the presidential palace in October he will be Indonesia's seventh president, its third to be elected by direct vote and its first to be a businessman and not come from the elite.
Tuesday's vote count nearly came unstuck after his rival accused the KPU of failing to properly investigate allegations of what his team said was widespread cheating.
But, unexpectedly, Prabowo decided not to challenge the result in the Constitutional Court, his lawyer Mahendradatta said. That could have dragged out the process for several weeks.
A former furniture businessman, Jokowi has had a meteoric rise through Indonesia's political establishment.
Born into poverty but now governor of Jakarta, he won over voters with a clean image and a reputation for competence in local government, in contrast to the autocracy, corruption and power politics that have weighed down the country for decades.
The new president, who starts his five-year term on Oct. 20, faces huge challenges to boost Indonesia's sagging growth, cut an unsettlingly large current account deficit that is weighing on the currency and meet pledges to improve the lot of its 240 million people.
Once surging foreign investment has started to taper off, with companies put off by the lack of infrastructure and what are seen as increasingly nationalist laws.
Poverty among the world's biggest Muslim population is also worsening and the budget is too tight to allow heavy spending.
One of Jokowi's first challenges will be to cut into fuel subsidies which distort the economy and eat up about a fifth of the annual budget.
Allegations of mass cheating
Though the KPU has been widely praised for the way it has conducted the vote, the Prabowo camp has alleged mass cheating in the ballot, enough, they say, to overturn Jokowi's victory.
Confusion over Prabowo's position regarding the election count was enough to rattle Jakarta shares, which had been rising on expectations of a win by Jokowi who is seen as more investor friendly.
At one stage the main index .JKSE was down two percent on worries that the increasingly shrill dispute could spill over into violence. Prices later recovered.
Stocks rose nearly 1 percent in early trading on Wednesday following the Jokowi win.
There have been no reports of major unrest since the election. Hundreds of thousands of police and military personnel are on heightened alert across the vast archipelago, home to the world's biggest Muslim population.