Croatia's conservative opposition has won the country's first election since it joined the European Union in 2013, preliminary results show.
But a narrow margin means lengthy coalition talks are likely to follow in coming days - or even weeks.
The new government will have to nurture a tentative economic recovery after six years of recession, and deal with thousands of migrants from the Middle East streaming through the tiny Adriatic state on their way to western and northern Europe.
The conservative alliance - led by opposition party HDZ - favours a tougher stance than its main rival, the ruling Social Democrats (SDP), on the migrant issue. The alliance is seeking stricter border controls to manage the flow of people crossing Croatia.
HDZ senior official and former foreign minister Gordan Jandrokovic estimated the party would have about 10 seats more than the SDP.
"We will talk to all those who want changes in Croatia," he said.
Preliminary results showed Most (Croat for "bridge"), which was founded three years ago, emerging as the third strongest group in parliament.
Most leader Bozo Petrov said his party would support a future government only if it went ahead with reforms of the judiciary and public administration, and sought to improve the business environment.
"For each of those reforms we would set deadlines and, if deadlines were not met, we would demand a parliamentary no-confidence vote. We know that, as things stand now, we control the majority in the parliament," he told national broadcaster HRT.
"A new election is much cheaper than an incapable government."
Croatian Prime Minister Zoran Milanovic had said SDP deserved another four-year mandate because the economy, heavily reliant on tourism, had started to grow after six years of recession - which wiped out about 13 percent of national output. The HDZ had said it could achieve faster growth than the current 1 percent.
Migrants one key issue
Some 338,000 migrants have passed through Croatia since mid-September, crossing the border from Serbia at a daily rate of 5000 or sometimes 10000. Few linger in Croatia, one of the poorest EU states where unemployment is at 16 percent, well above the bloc's 9 percent average.
Driven largely by economic concerns, the election follows a landmark victory by opposition conservatives in Poland last month. The Polish Law and Justice party pledged to oppose mandatory quotas for relocation of migrants within the EU and echoes the HDZ's nationalist undertones.
The HDZ, which steered Croatia to independence from Serb-dominated Yugoslavia in 1991, has accused the outgoing centre-left government of Mr Milanovic of being soft and ineffectual in handling the migrant issue.
Croatia has become a transit hub for migrants, many from Syria, Afghanistan and Iraq, who want to travel north.
Croatian Interior Minister Ranko Ostojic said this week that 320,000 migrants had passed through the country so far this year.
The cost of managing the arrivals was around $437,000 a day, he said.
Numbers increased when Hungary shut its border with Serbia, forcing more people to seek an alternative route north through Croatia.
Mr Milanovic and his party have won approval for their compassionate handling of the refugee crisis.
But HDZ leader Tomislav Karamarko has suggested using troops and fences to reduce the number of arrivals.
As well as the migrant crisis, Croatia's next government will be faced with a weak economy: unemployment is at 15.4 percent - the third-highest in the European Union, after Greece and Spain.
Youth unemployment is at 43.1 percent - also the third-highest in the EU.
The country has suffered six years of recession, but has seen little growth this year.
The election is Croatia's first since it joined the EU in 2013.