Exit polls showed the Civic Platform won around 44 percent of the vote. Law and Justice had just over 30 percent.
Prime Minister Jaroslaw Kaczynski conceded defeat. His brother Lech, the president, does not face an election until 2010 but opposition parties together looked set to get enough seats in parliament to trump his power to veto legislation.
"The Platform's role will be to return Poland to the heart of Europe," said Bronislaw Komorowski, a top Platform official.
Civic Platform leader Donald Tusk, expected to be the next prime minister of the biggest ex-communist EU member, said he welcomed the mandate for change given by the 55 percent turnout: "We are moved that Poles went to cast their ballots."
The Civic Platform appeared just short of the half the 460 lower house seats needed to govern alone, but the centrist Peasants' Party said it was ready for coalition talks.
The result was the best by any party in the country of 38 million since communism ended in 1989. "We have failed against a wide front," the prime minister said. "We will be a decisive, tough opposition."
The election was called two years early after his last coalition collapsed amid acrimony over a corruption probe.
Despite a booming economy, the Kaczynskis had ruled during constant infighting, particularly over the fight against post-communist graft that has been their central policy.
The Platform was the clear favourite of financial markets, which expect reforms such as tax cuts and privatization that would also help central Europe's biggest economy towards adopting the euro currency.
"This is a far better outcome than generally expected and is likely to be taken very positively by the markets," said Silja Sepping of Lehman Brothers. The zloty has been at a 5-year high on expectations of a Civic Platform win.
A senior Platform official said the party would seek to bring home some 900 troops from the U.S.-led force in Iraq. He also made clear it would toughen its stance with Washington over plans for a controversial "missile shield" base in Poland.
Above all, the party aims to rebuild ties with EU partners such as Germany. They were badly strained under the Kaczynskis.
"There will be a huge change in style. Poland's credibility will be rebuilt," said Zbigniew Lewicki of Warsaw University. "We have a chance to become a normal European country. This is the end of a dark period for this country. It is over now and it is over before serious damage had been done."
The opposition's strength is among youths and in cities enjoying the fastest economic growth for a decade. The Kaczynskis have more support among staunchly Catholic Poles and older people in rural areas, who feel left out by the change.
"Finally!" shouted building worker Marek Stepien as he celebrated the result in the city of Gdansk. "The situation we had here was impossible, unbearable."
But 58-year-old retiree Boguslawa Janasz said "I have lived long enough to know that Law and Justice governed well and assured security."
Turnout was the highest for a parliamentary election since 1989. That compared to 40 percent in 2005, when the low voter participation helped the Kaczynskis.
Long queues formed at voting stations in Britain and Ireland, where many of some 2 million emigrants have gone to seek work since Poland joined the European Union in 2004.
"The ruling party has done nothing but quarrel and seek problems in places where there are none," said Piotr Kuljon, 35, a supermarket cashier who was voting in Manchester, England.
Exit polls indicated that opposition parties would together get the three-fifths of the 460 seats that they need in the lower house of parliament to be able to stop the president using his veto -- as long as they are united on a specific issue.
In the Senate, the Platform was forecast to take 70 of 100 seats. Final results are expected on Tuesday.