Poland's incumbent President Andrzej Duda has narrowly beaten challenger Rafal Trzaskowski in Sunday's presidential vote.
The National Electoral Commission said Mr Duda had won 51.2% of the votes.
It is Poland's slimmest presidential election victory since the end of communism in 1989.
One of the major issues of the election was the future of the country's strained relations with the European Union.
Mr Duda is a social conservative allied with the government led by the nationalist Law and Justice (PiS) party, while Mr Trzaskowski is the socially liberal mayor of Warsaw.
Mr Duda's win is expected to lead to further controversial reforms to the judiciary and continued opposition to abortion and gay rights.
During the campaign Mr Duda came under heavy criticism after he said LGBT rights were an "ideology" more destructive than communism.
What are the results?
At a press conference on Monday morning, the heads of the electoral commission said they were not sure when complete results would be announced, as some polling stations had yet to submit their counts.
But with 99% of all constituencies reporting, those tallies were not expected to affect the result. Turnout was reportedly 68.2%.
The opposition Civic Platform (PO) group - which backed Mr Trzaskowski - told Reuters news agency it was collecting information on voting "irregularities" after the polls closed on Sunday, including reports of Poles abroad not receiving their voting packages in time to take part in the election.
Analysts believe the close result could lead to court challenges.
"I think there will certainly be electoral protests and I think the whole issue will end up in the Supreme Court," Warsaw University political scientist Anna Materska-Sosnowska told AFP news agency.
The election had been due to take place in May, when Mr Duda was higher in the polls and stood a better chance of winning in the first round.
Although the coronavirus pandemic had not yet peaked, the government was desperate for the May vote to go ahead.
It eventually backed down when a junior coalition partner joined the opposition in saying the PiS was putting politics before public health.
What does this mean for Poland and the EU?
President Duda's victory means the governing PiS party can now implement its programme unhindered until the next parliamentary elections in three years.
The presidential election was the closest since the fall of communism in 1989 but the high turnout means President Duda won a clear mandate.
Despite the economic impact of the coronavirus pandemic, the government has pledged to continue its popular welfare scheme that has helped raise many Polish families out of poverty.
More controversially, the PiS has said it wants to complete its overhaul of the judiciary - a policy criticised by the EU and many other international organisations for undermining the rule of law in Poland. That signals more tension with Brussels.
The PiS may want to use Mr Duda's victory to pursue greater political control of local government and the private media.
But passing legislation to limit foreign ownership of critical private media is difficult under EU rules and risks antagonising Poland's chief ally, the US, as one of the country's most popular broadcasters, TVN, is owned by an American company.
Mr Duda's victory shows there is a strong electorate for social conservatism and generous state hand outs. But the closeness of the vote also suggests that many in Poland are uneasy about the government's attempts to introduce a more illiberal democracy.
What's been the media reaction?
Polish and European press pundits find the election exposing profound fault lines in Polish society, BBC Monitoring reports.
"Young against old, cities against countryside", says Polityka weekly in its headline.
Conservative daily Rzeczpospolita calls for "a mending of divisions" and says politicians across the spectrum realise there is an urgent need to "glue together" a polarised society.
Some commentators say big guns in the media and the state were deployed against the opposition candidate in what liberal daily Gazeta Wyborcza sees as a "David vs Goliath" battle.
"Just like Orwell's Ministry of Truth, PiS media promoted the cult of Duda, slinging mud at Rafal Trzaskowski." But, "despite the machinery of lies, the democracy camp proved that one half of society thinks: 'NO, we have had enough!'"
Polityka finds a positive for the losing side and says Mr Trzaskowski "breathed new life" into a "lethargic" opposition.
This is echoed by Germany's Sueddeutsche Zeitung, which says Mr Trzaszkowski is "a hero, even without a victory".
In neighbouring Slovakia, the Aktuality.sk website says Mr Duda's victory will tempt the ruling party to "see just how far they can go".