Wojciech Hermelinski, head of the National Electoral Commission, said the centrist-right Law and Justice party, the PiS, won with 37.6% of the vote.
The PiS is led by Jaroslaw Kaczynski, twin brother to former Polish President Lech Kaczynski, who died in a plane crash in 2010.
Analysts say the party is more conservative on immigration than incumbent Prime Minister Ewa Kopacz's Civil Platform Party -- known as the PO for its name in Polish, Platforma Obywatelska -- which results show trailed the PiS with 24.1%.
Leftist economics, rightist political agenda?
Writing for The Conversation last week
, University of Michigan Professor of History Brian Porter-Szucs said the PiS called for more social spending, taxing of the wealthy and re-nationalization of key assets and was supported by trade unions.
"On the other hand, PiS is opposed to immigrants, gays, feminists, liberals, and in general all 'foreigners,' " Porter-Szucs said, adding that the party's second pillar was the Catholic Church in Poland.
"This combination of a 'leftist' socioeconomic agenda with a 'rightist' cultural and political agenda might seem strange, but in fact it has deep roots in Poland and throughout contemporary Europe," he said.
'Waitergate' rocked the PO
The defeat was not entirely unexpected for Kopacz's PO party.
Duda on Monday congratulated the PiS and its leaders on Twitter. "Also respect to all those who fought. Poland is one," the tweet said.
In June, the PO was rocked by the results of an investigation into a 2014 eavesdropping scandal dubbed "waitergate," in which government officials' conversations at Warsaw restaurants were secretly tapped.
The scandal led to the resignations of four government ministers
and the parliamentary speaker, former Foreign Minister Radoslaw Sikorski.
What results mean for Europe
Writing for OpenEurope.org
before the results were announced, analyst Pawel Swidlicki said if the exit polls proved correct and PiS won enough seats for an overall majority, it would be the first party to have done so in post-Communist times.
"Anti-establishment, anti-politician sentiment played a central role in the campaign and PiS was successfully able to tap into this, but it could also fall afoul of the same forces in the future," he said.
Swidlicki said that to cast the results as Poland turning "away from Europe" would be superficial analysis, with recent polling suggesting that the vast majority of Poles were in favor of European Union membership.
But he highlighted two areas where a new Polish government might be at odds with the EU.
"The debate about the refugee crisis certainly triggered a nationalist reflex and EU member states' decision to force through the relocation of 160,000 refugees last month could have profound and long-lasting implications for Poles' attitudes towards the EU," he said, adding that it remained to be seen if a PiS government would accept the 7,000 refugees agreed to by the OP government.
The second issue was membership in the single-currency eurozone, Swidlicki said, with PiS arguing that Poland should only join once its standard of living is equal to that of Western Europe.
Poland has continued to grow through the global financial crisis but, in general, workers can earn more in neighboring Germany than they can at home.
"Given that GDP per capita in Poland is 68% of the EU average -- compared to 107% for the eurozone as a whole -- this could well be a matter of decades," Swidlicki wrote.