WARSAW—Poland's electoral authority on Monday officially declared conservative challenger Andrzej Duda as the winner of Sunday's presidential election, unseating the incumbent president and heralding a broader political recasting of the European Union's largest emerging economy.

Mr. Duda won 51.55% of the vote, the authority said, while President Bronislaw Komorowski won 48.45%.

Mr. Duda, a 43-year-old conservative, captured the imagination of many voters with promises for change after eight years of rule by the center-right camp. Mr. Komorowski, 63, initially hoped to easily win a second term in light of opinion polls from earlier this year that showed him well ahead, but his popularity dwindled as the election neared.

Voter turnout topped 55%, relatively high in a country where elections often elicit an apathetic response. Mr. Duda will be sworn in for a five-year term on Aug. 6.

Mr. Komorowski's failed re-election campaign was marred by gaffes, with some of his appearances giving many voters the impression that he was out of touch with the general public.

"I was stunned when he told a young man to take a loan," said Bogdan Zdrojewski, a member of the European Parliament from Mr. Komorowski's own Civic Platform party, referring to the advice the president gave when asked about low wages in Poland.

Poland's average net wage in March was $800, a level that is both a boon to its competitiveness and a spur to Poles migrating in search of better pay. More than two million people have emigrated from Poland since it joined the EU in 2004, when employment restrictions were lifted.

Mr. Duda pledged to draft laws to give bigger tax breaks to the least affluent and reverse a recent increase in the retirement age—proposals Mr. Komorowski eventually echoed in his campaign despite first calling them populist.

The president-elect on Monday continued the public walks that became the hallmark of his campaign, handing out coffee to passersby in central Warsaw. When asked about steps to stop migration from Poland, he said the country needed to grow faster. The Polish economy grew at an annualized rate of 3.5% in the first quarter, compared with an EU average of 1.4%.

Mr. Duda ran as a member of the Law and Justice party, which ruled from 2005 to 2007 in a coalition with nationalists and populists. In line with the nonpartisan traditions of the presidential post, he said Monday he would leave the party, whose official line toward both EU partners and Russia is tougher than the more accommodating policies pursued since 2007 by the center-right camp.

Russian President Vladimir Putin on Monday sent a message to Mr. Duda congratulating him on his victory and wishing him success. Poland's relationship with Russia has been tense, particularly since the separatist conflict in Ukraine, which lies between the two countries.

During his election campaign, Mr. Duda said he would urge Western partners to stand up to the Kremlin for its support of separatist pro-Russian rebels in eastern Ukraine.

Mr. Duda has also said he wanted the North Atlantic Treaty Organization and the U.S. in particular to move troops to Poland to deter any future Russian aggression.

Mr. Duda's election will likely stiffen opposition in Poland to adopting the euro and to the EU's plans for new targets for cuts in carbon-dioxide emissions, which he has said would undermine the energy policy of the coal-rich country.

Write to Martin M. Sobczyk at martin.sobczyk@wsj.com

Subscribe to WSJ: http://online.wsj.com?mod=djnwires