By Ben Otto And I Made Sentana 

JAKARTA, Indonesia--Indonesia's Constitutional Court rejected a legal challenge to President-elect Joko Widodo's electoral win, clearing the final hurdle for him to take office in October.

After two weeks of proceedings, the Constitutional Court ruled Thursday that Prabowo Subianto--the former army general who lost the country's election last month by six percentage points and mounted the legal appeal--failed to prove his allegations of widespread voting irregularities.

The court "rejects the appeal from the plaintiff," Chief Justice Hamdan Zoelva said at the conclusion of the reading of the verdict, which took more than six hours.

The court is the country's highest authority for election disputes, and its decision can't be appealed. That means Mr. Widodo, governor of the capital Jakarta, will assume office Oct. 20, when President Susilo Bambang Yudhoyono steps down after reaching his two-term limit.

Thousands of Subianto supporters turned out on streets near the court Thursday afternoon, with police briefly firing tear gas and using water cannons to keep them outside barbed-wire barricades set up near the court. Several police and almost a dozen protesters were taken to a government hospital for minor injuries, a hospital paramedic said.

The number of protesters steadily dwindled during the reading of the verdict, and there were no reports of unrest outside the capital.

The nine-member court rejected most claims of voting irregularities submitted by Mr. Subianto's lawyers late last month. It did accept that some irregularities occurred in places like the remote province of Papua, but said that a revote there wasn't necessary given that it couldn't overturn the results of the election, which Mr. Widodo won by more than eight million votes.

Mr. Subianto's team said it was disappointed by the court decision but respected the ruling. In a statement read to reporters by his spokesman, Mr. Subianto offered no concession to the winner and reiterated his belief that the vote count was plagued by irregularities.

"Based on all of the facts and the witnesses' testimony, we are sure there is an indication of fraud and injustice within the presidential election of 2014," Mr. Subianto said, according to the statement.

The tradition of the loser offering a concession speech has yet to develop in Indonesia's brief democratic history. Neither of the runner-up teams in Indonesia's previous two direct presidential elections, in 2004 and 2009, made concession speeches after similarly mounting unsuccessful legal challenges at the Constitutional Court.

The court ruling frees Mr. Widodo to focus on an economy in dire need of reinvention, and the next few weeks will likely provide more clues to how he will govern. He has catapulted onto the national stage in a manner similar to Barack Obama's ascent to the White House, and the high hopes--as well as apprehensions--around him are similarly weighted.

Popularly known as Jokowi, he takes over at a time when economic growth is slipping as a commodity boom fades and as Indonesia looks to shift away from tin, nickel and timber and other resource exports to attract foreign investment in manufacturing and value-added industries.

His ability to address issues involving foreign investment or macroeconomics has yet to be tested. Nevertheless, his brief stint as governor of Jakarta has inspired hopes he will be able to push through the corruption and parliamentary gridlock that has stalled the government of President Yudhoyono. Foreign businesses have taken heart in statements that Mr. Widodo will honor the rule of law, including existing contracts.

The country's resources and population of more than 240 million has attracted record amounts of foreign investment in recent years, but the pace of investment growth has declined, and investments in manufacturing have often lost out to countries like Vietnam that offer more competitive wages and tax incentives.

Investors are asking the president-elect for two things above all: legal certainty in sectors from mining to oil exploration, and a spending bonanza on infrastructure to clear up paralyzing bottlenecks that have held back Indonesia's economic growth.

"The sense...from talking to those around [Mr. Widodo] is that he will be pragmatic and will be a decision maker," said Andrew White, managing director of the American Chamber of Commerce in Jakarta. "It has been the lack of pragmatism and the lack of decision making that has ground down the patience of investors in the second administration" of Mr. Yudhoyono.

Foreigners will be watching especially how he approaches mining. The industry traditionally has been one of the greatest sources of foreign investment, but new rules have forced many foreign companies to reduce their ownership in companies and alter the terms of their long-term contracts. Phoenix-based Newmont Mining Corp. is currently seeking international arbitration over a contract dispute with the government.

"He's saying the right things in the sense of expressing a willingness to sit down with mining companies and other stakeholders in the mining industry in an endeavor to understand the issues currently facing" the industry, said Bill Sullivan, a Jakarta-based adviser to major miners.

In a statement late Thursday, Mr. Widodo said the court decision cleared the way for him to prepare his government. Last week he named a small team to oversee the transition period, which was working to bring some political parties aligned with Mr. Subianto into his fold. If successful, that would give his ruling coalition a majority in the national parliament, alleviating some concern among investors that lawmakers will hold him hostage in his reform agenda.

He has also continued to say his cabinet will comprise professionals and be free from horse trading among political parties that has traditionally led to fractious cabinets.

The first major economic test of his government--one that has bedeviled previous governments--will be to rein in spending on subsidies that make fuel in Indonesia some of the cheapest in the region. Those subsidies have ballooned to take up almost a fifth of all government spending. Curbing them would free up funds to improve infrastructure in the world's largest Muslim-majority country.

People familiar with the matter say Mr. Widodo's transition team is in talks to persuade the current administration to raise fuel prices before he assumes power, giving him some breathing room to roll out new programs.

Ideally, an increase in fuel prices will be "split by the current and next governments," Mr. Widodo said Tuesday.

He will also be particularly aware of the need to recast Indonesia as a place open for business for foreigners to attract more investment and narrow a persistent deficit in the current account.

Mr. Widodo said last week that South Korean electronics giant Samsung will expand manufacturing operations to produce handphones in Indonesia after years of passing up the country in favor of Vietnam. Samsung has said only that it is considering an investment.

Earlier this year, Mr. Widodo also met with the head of Taiwan-based Hon Hai Precision Industry Co.--the manufacturer also known as Foxconn that assembles many of Apple Inc.'s devices--to announce plans for a major factory complex in Indonesia. Those plans have since stalled, but the company says it continues to weigh its options in Indonesia.

Linda Silaen, Andreas Ismar and Richard C. Paddock contributed to this article.

Write to Ben Otto at ben.otto@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires