Nawrocki secured just under 51 per cent of the vote in a very tight race against liberal Warsaw Mayor Rafał Trzaskowski, who received just over 49 per cent.
The close race had the country on edge since a first round two weeks earlier and through the night into Monday, revealing deep divisions in the country along the eastern flank of NATO and the European Union.
The vote was seen as a test of the nation's support for a pro-European course versus US President Donald Trump-style nationalism.
Nawrocki, 42, a eurosceptic historian and amateur boxer who ran a national remembrance institute, campaigned on a promise to ensure economic and social policies favour Poles over other nationalities, including refugees from neighbouring Ukraine.
An early exit poll released on Sunday evening suggested Trzaskowski was headed to victory before updated polling reversed the picture hours later.
The outcome indicates that Poland can be expected to take a more nationalist path under its new leader, who was backed by Trump who granted him an audience in the White House in early May during the Polish presidential campaign.
In Poland, the president holds a five-year term and has broad powers, including representing the country abroad, shaping foreign policy, appointing the prime minister and the cabinet, and serving as commander-in-chief of the armed forces in the event of war.
with dpa and Reuters