The candidate of Poland's ruling centrist Civic Coalition (KO), Rafal Trzaskowski, was seen narrowly ahead in the presidential election second round with 50.3% of votes, an Ipsos exit poll for TVN, TVP and Polsat indicates.
Karol Nawrocki, the candidate backed by nationalist opposition party Law and Justice (PiS), was second with 49.7%, the poll suggested.
Official results are expected tomorrow, although a late poll that mixes some results with exit surveys was expected to be published overnight.
Both candidates claimed victory after the exit poll indicated they were neck and neck.
"We won ... by a whisker," Mr Trzaskowski told supporters after the poll showed him narrowly ahead.
Mr Nawrocki told his election night rally: "Tonight we will win. We will win and we will save Poland."
Mr Trzaskowski, 53, campaigned on a promise to help the government of Prime Minister Donald Tusk complete its democratic reforms, which they both say aim to repair an erosion of checks and balances under the previous nationalist government that lost power in 2023.
Parliament holds most of the power in Poland, but the president can veto legislation, so the vote is being watched closely in neighbouring Ukraine, as well as in Russia, the US and across the European Union.
Both candidates agreed on the need to spend heavily on defence, as US President Donald Trump is demanding from Europe, and to continue supporting Ukraine in its fight against Russia's three-year-old invasion.
But while Mr Trzaskowski sees Ukraine's future membership of NATO as essential for Poland's security, Mr Nawrocki said recently that if he were president he would not ratify it because of the danger of the alliance being drawn into war with Russia.
Social issues were also at stake in the election.
Mr Trzaskowski has said he wanted to see Poland's near total ban on abortion eased, something that outgoing nationalist President Andrzej Duda strongly opposed.
The tight election has also has major implications for the country's role in Europe and LGBTQ rights.

A victory for Mr Trzaskowski would be a major boost for the progressive agenda of the government led by Prime Minister Donald Tusk, a former European Council president.
It could also mean significant social changes such as the introduction of civil partnerships for same-sex couples.
Presidents in Poland, a fast-growing economy of 38 million people, have the power to veto legislation and are also the commander-in-chief of the armed forces.
Victory for Mr Nawrocki would embolden the populist Law and Justice (PiS) party, which ruled Poland between 2015 and 2023, and could lead to fresh parliamentary elections.
Many Nawrocki supporters want stricter curbs on immigration and advocate for conservative values and more sovereignty for the country within the European Union.
Coming around a year-and-a-half since Mr Tusk took office, the vote provides the toughest test yet of support for his broad coalition government, with Mr Nawrocki presenting the ballot as a referendum on its actions.
The first round of the election on 18 May saw a surge in support for the anti-establishment far-right, suggesting that the KO-PiS duopoly that has dominated Polish politics for a generation may be starting to fracture.
Nevertheless, after a tumultuous campaign in which Mr Nawrocki in particular faced a slew of negative media reports about his alleged past conduct, once again candidates representing the two main parties faced off in the second round.
PiS has traditionally enjoyed high support in small towns and rural areas, especially in the south and east.
These areas are typically more socially conservative than larger cities and poorer, creating a sense of exclusion that PiS has tapped into.
KO, meanwhile, campaigns on a pro-European centrist agenda that appeals to more liberal-minded Poles who mainly live in cities or bigger towns.
'Real clash of civilisations'
"We should not give in to European pressure," 40-year-old Agnieszka Prokopiuk, a homemaker, said ahead of the vote.
"We need to make our own way ... and not succumb to trends from the West," she said in the city of Biala Podlaska in eastern Poland near the Belarus border.
Tomasz Czublun, a 48-year-old mechanic, said: "The European Union is important but the sovereignty of our country is much more important."
Anna Materska-Sosnowska, a politics expert, called the election "a real clash of civilisations" because of the wide policy differences between the candidates.
Many Trzaskowski voters support greater integration within the EU and an acceleration of social reforms.
Malgorzata Wojciechowska, a tour guide and teacher in her fifties, said Polish women "unfortunately do not have the same rights as our European friends".
"I hope that Rafal Trzaskowski will relaunch the debate on abortion so that we can finally live in a free country where we can have our own opinion," she told AFP.
The election is also being watched closely in Ukraine, which is seeking to bolster international diplomatic support in its negotiations with Russia as its resistance to Moscow's invasion grinds on.
Mr Nawrocki, an admirer of US President Donald Trump, opposes NATO membership for Ukraine and has called for curbs on benefits for the estimated one million Ukrainian refugees in Poland.
He used his last campaign hours on Friday to leave flowers at a monument to Poles killed by Ukrainian nationalists during World War II.
"It was a genocide against the Polish people," he said.
The election's final result is expected to hinge on whether Mr Trzaskowski can mobilise enough supporters and whether far-right voters will cast their ballots for Mr Nawrocki.
Far-right candidates secured more than 21% of the vote in the election's first round, which Mr Trzaskowski won by a razor-thin margin of 31% against 30% for Mr Nawrocki.