The conservative challenger in Poland’s presidential election, Andrzej Duda, has defeated the incumbent, Bronislaw Komorowski, final results show.
Mr Duda won 51.5% of votes in the run-off, while Mr Komorowski polled 48.5%.
Mr Duda had edged Mr Komorowski, who had been the favourite, in the first round but did not gain the 50% needed to win outright.
The president has limited powers, but is head of the armed forces and can veto new laws.
The victory will be a wake-up call to Prime Minister Ewa Kopacz, an ally of Mr Komorowski, ahead of parliamentary elections this autumn.
Mr Komorowski conceded victory earlier, as exit polls were announced.
“I respect your choice,” he said, addressing voters. “I wish my challenger a successful presidency.”
Speaking to supporters in Warsaw, Mr Duda said: “Thank you President Bronislaw Komorowski for the rivalry of this presidential campaign and for your congratulations.
“Those who voted for me voted for change. Together we can change Poland.”
Mr Komorowski, 62, took office five years ago after his predecessor, Lech Kaczynski, died in a plane crash.
He had been the favourite according to earlier opinion polls, and had been looking for a second term.
Mr Duda, 43, is from the right-wing opposition Law and Justice party, which is led by former President Kaczynski’s twin brother, Jaroslaw.
In the first round, Mr Duda attracted most support in the more conservative eastern regions of the country, near the border with Ukraine and Belarus.