Poland's opposition Law and Justice party - conservative and Eurosceptic - has won parliamentary elections.
Preliminary results gave the party 37.6% of the vote, but it was not immediately clear if that would be enough for it to govern alone.
Its leader Jaroslaw Kaczynski claimed victory, and the outgoing Prime Minister, Ewa Kopacz of the centrist Civic Platform, admitted defeat.
Law and Justice (PiS) has strong support in poorer, rural areas.
Civic Platform, the pro-market party that governed for the last eight years, got 24.1% of the vote.
Three other parties also won enough votes to get seats in parliament: a new right-wing party led by rock star Pawel Kukiz with 8.8%; a new pro-business party, Modern Poland, with 7.6%; and the agrarian Polish People's Party with 5.1%.
The election authority is expected to announce how many seats the parties get in parliament on Tuesday.
Exit polls suggested Law and Justice would have a small majority - making it the first time a single party has won enough seats to govern alone since democracy was restored in 1989.
"We will exert law but there will be no taking of revenge. There will be no squaring of personal accounts," said Mr Kaczynski.
"There will be no kicking of those who have fallen through their own fault and very rightly so."
Analysis: Adam Easton, BBC News, Warsaw
It was a historic election. It will be the first time since 1989 that there will be no left-wing party in parliament.
Law and Justice won big because they offered simple, concrete policies for the many in Poland that feel untouched by the country's impressive economic growth. It offered higher child care benefits and tax breaks for the less well-off.
After eight years in office many Poles had grown weary of the governing centrist Civic Platform's unfulfilled promises, scandals and what was perceived by some to be an aloof attitude.
Law and Justice also stuck with its winning formula of presenting a more moderate face than its rather combative leader Jaroslaw Kaczynski.
That moderate face belongs to Beata Szydlo, a 52-year-old miner's daughter and avid reader, who will become the country's next prime minister.
Beata Szydlo said she was grateful for the support of the Polish people.
"We have won because we have been consistent in facing all the challenges ahead of us and we followed in the footsteps of the late President Lech Kaczynski," she said.
"We wouldn't have won had it not been for the Polish people who told us about their expectations and needs, and who in the end voted for us."
Europe's refugee crisis also proved to be a key topic of debate before the election. While the government has agreed to take in 7,000 migrants, opposition parties have spoken out against the move.
Mr Kaczynski, 66, was not running as prime minister and instead nominated Ms Szydlo, a relative unknown, as the party's choice for the post.
However, some observers said Mr Kaczynski - the twin brother of Poland's late president Lech - could take on the top job himself in the months to come.
Last week, Mr Kaczynski was criticised for suggesting migrants could bring diseases and parasites to Poland.
PiS is close to the country's powerful Roman Catholic Church and has promised increased benefits and tax breaks.
It supports a ban on abortions and in-vitro fertilisation and believes a strong Nato is necessary to offset the perceived threat from Russia.
Civic Platform for its part sought closer ties with the EU.
Despite overseeing eight years of impressive economic growth it was beaten into second place and will become the main opposition party.