It came after unofficial tallies from polling agencies showed him leading with around 53% of the vote against Mr Prabowo's 47%.
Flanked by members of his Indonesian Democratic Party of Struggle in the capital, Mr Widodo said: "We would like to greatly thank all the Indonesian people... as well as party members who worked hard from morning to evening."
Mr Prabowo's campaign director said the .former general will not concede defeat.
"The process is still ongoing," said Mahfud M.D. "Based on our survey institutes... the victory is on our side."
It came after a bitterly fought campaign that saw long-time favourite Mr Widodo's lead shrink dramatically, voters in the world's third-biggest democracy have faced a choice starkly different candidates.
A former furniture exporter from a humble background, Mr Widodo, known by his nickname Jokowi, is the first serious presidential contender without links to the authoritarian past. Should he win, he is seen as likely to usher in a new style of leadership and consolidate democracy.
Mr Prabowo, a former son-in-law of Suharto who has admitted ordering the abduction of democracy activists before the strongman's downfall in 1998, has won support with promises of firm leadership in a country where many yearn for a strong figurehead.
But critics fear he may shift Indonesia back towards authoritarian rule.
Earlier, Mr Widodo was mobbed by hundreds of journalists and supporters as he voted at a polling station near the Jakarta governor's residence in the centre of the capital.
Mr Prabowo was also greeted by an enthusiastic crowd as he voted at a polling station near his countryside house outside the capital, arriving in a jeep and escorted by two mounted policemen.
"I'm very optimistic, and God willing we will get support from people everywhere," said the 63-year-old after voting. "My hope is that the election went well and smoothly, with no fraud and no intimidation."
Some 190 million voters were eligible to cast ballots across the sprawling archipelago of more than 17,000 islands that spans three time zones.
Polling stations closed across the country, from eastern Papua, to the main island of Java and jungle-clad Sumatra in the west, closed at 1pm and no major disruptions to voting were reported.
Several months ago Mr Widodo looked to be on a smooth course to lead the country. But, after a polarising campaign, his once-huge lead has shrunk.
The Jakarta governor was targeted by smears, including a claim that he is an ethnic Chinese Christian and not a Muslim, a deeply damaging charge in the world's most populous Muslim-majority country. He vehemently denied the claim.
Analysts have said the large number of undecided voters has made the race hard to call. Official results are not expected for about two weeks. Whoever wins will be the country's second directly elected president after Susilo Bambang Yudhoyono, who steps down in October after a decade of stable but often indecisive rule.
It will be a delicate transition. Growth is slowing in Southeast Asia's top economy, corruption is rampant, millions remain mired in poverty, and fears are mounting that Islamic radicals returning from Middle East conflicts could revive militant networks.
Mr Widodo shot to national prominence when he was elected Jakarta governor in 2012, and quickly won legions of fans with his common touch and efforts to solve the capital's myriad problems.
He would make regular tours of the metropolis's sprawling slums in casual clothes and was often spotted at heavy metal concerts.
Mr Prabowo, now a wealthy businessman, has played up his military background on the campaign trail, at a time when nostalgia is growing in some quarters for a return to the strong rule of the Suharto years.
Many have become disillusioned with the country's chaotic democracy, and hope a stronger leader can crack down on corruption in one of the world's most graft-ridden nations.
But Mr Prabowo's comments about democracy have caused concern - in one recent talk, he reportedly said that a Western-style political system, including direct elections, "doesn't suit" Indonesia.