The Netherlands' main exit poll suggests Prime Minister Mark Rutte has won the Dutch elections, easily beating anti-Islam firebrand Geert Wilders.

For the two-time Prime Minister Rutte, the poll indicated an economic recovery and his hardline handling of a diplomatic dispute with Turkey over the past week had won him support.

The Ipsos polling company gave Rutte's party 31 of the 150 seats in the lower house of parliament, compared with 19 seats for Wilders' PVV.

"Today was good day for democracy, to see all these lines of people voting. We haven’t seen that in a long time," Rutte said at a post-election party in the Hague.

"It was a night where the Netherlands, after Brexit, after the American elections, said 'stop' to the wrong kind of populism."

At 81 percent, turnout was the highest in 30 years

Wilders vowed to play a prominent role in Dutch politics in the future, despite the dismal exit poll results.

"Thank you PVV Voters! We won seats!," Wilders said in a tweet. "The first victory is in! And Rutte has not seen the last of me yet!!"

READ MORE: What six Dutch voters have to say

The exit poll predicted 19 seats each for the Christian Democratic Appeal (CDA) and Democracy Party (D66).

It was conducted at 43 of the 9,300 polling stations across the country on Wednesday. It had a margin of error of two percentage points.

Rutte will now get the first chance at forming a new government, which will be challenging because of the high number of medium-sized parties.

As it stands now, a coalition consisting of fewer than four parties seems unlikely. Chances of Wilders joining any coalition are very slim, since most party leaders have said that they are not willing to work with Wilders. Wilders, however, has said he is open to talks.

READ MORE: Dutch Muslims reflect on Geert Wilders before vote

The Dutch vote, which has been overshadowed by a diplomatic dispute between the Netherlands and Turkey, has essentially come down to a tight race between Rutte's centre-right party and that of far-right, anti-Islam populist Wilders.

As many as 13 million people were eligible to vote in Wednesday's election and 28 parties were competing for the 150 seats in the Dutch lower house of parliament.

Matthijs Rooduijn, a political sociologist at Utrecht University, told Al Jazeera that Rutte projected himself as a strong nationalist and traditional leader, which is why voters may have chosen him over Wilders.

"The refugee crisis, the Brexit referendum - they were all good news for Wilders, but with right-wing parties embracing a similar stance, they were able to lure Wilders supporters," said Rooduijn.

Wilders, 53, has vowed to shut mosques, ban the Quran and close the country's borders. He also wants to pull the country out of the European Union , an institution that it helped found, in a so-called Nexit.

One Muslim voter told AFP news agency that Wilders' fiery anti-Islam rhetoric had prompted her family to come out and vote.

"My mother has never voted before, but now she has and encouraged the whole family to do so because the situation is serious."

Speaking to reporters after he cast his ballot at a school, Wilders said: "Whatever the outcome of the election, the genie will not go back into the bottle. This patriotic revolution, whether today or tomorrow, will stay."

Rutte, seeking to lead the Netherlands for a third successive term, is a liberal free-marketeer championing this year's election on a pledge of safety and stability.

Analysts said his uncharacteristically strong stance since the weekend in a diplomatic crisis with Turkey - when Dutch authorities expelled one Turkish minister while another was refused permission to fly into the country to attend a political rally - has boosted his image with voters.