BRATISLAVA, Slovakia — The longtime governing party in Slovakia suffered a sweeping defeat in national elections on Saturday, paving the way for a new government coalition that promised to fight corruption and promote the rule of law.

The leader of the largest opposition party, Igor Matovic, vowed to make the most of the moment.

“We took a difficult road during this campaign,” said Mr. Matovic, the leader of the Ordinary People and Independent Personalities party, or OLANO. “We tried to wake up a sleeping dragon. We are very happy that Slovakia has woken up.”

The election — in which Mr. Matovic’s party won 25 percent of the vote, compared with 18 percent for the governing party, SMER-SD — was the culmination of one of the most turbulent periods in Slovak politics. And the issues convulsing the small Central European country are the same ones coursing through democracies across the former Soviet bloc.

Populists hope to tap into public anger by appealing to an aggrieved sense of nationalism, often competing with progressives who cling to the flag of the European Union as a symbol of a future that brings the Continent’s nations closer, not further apart.