For the two-time prime minister Mr Rutte, the poll indicated that an economic recovery and his hard-line handling of a diplomatic dispute with Turkey over the past week has won him support.
The Ipsos polling company gave Mr Rutte's party 31 of the 150 seats in the lower house of parliament, compared to 19 seats for 3 other parties, including that of Mr Wilders. A second exit poll also showed the Prime Minister's party had the largest share after 82 per cent of voters turned out.
For Mr Wilders, the poll was a test whether his fiery nationalist rhetoric caught the imagination of the population. Even if he increased his total in the 150-seat legislature from 15 to 19, it is was a disappointment since he was seeking to become the biggest party. Weeks or months of coalition talks are expected to follow.
"Rutte has not seen the back of me!!" Mr Wilders said in a Twitter reaction.
The exit poll 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.
With France and Germany facing elections in the months ahead, Mr Rutte hoped to slow the momentum of what he called the “wrong sort of populism” after last's year British vote to leave the European Union and the election of US President Donald Trump.
“This is a chance for a big democracy like the Netherlands to make a point to stop this toppling over of the domino stones of the wrong sort of populism,” Mr Rutte said after voting.
Germany's foreign office was quick to react on Twitter. It said: "Large majority of Dutch voters have rejected anti European populists. That's good news. We need you for a strong #Europe!"
Mr Wilders had insisted that whatever the result of Wednesday's election, the kind of populist politics he and others in Europe represent are not going away.
“The genie will not go back into the bottle. People feel misrepresented,” he said, predicting the feeling would surface in the French and Germany elections. But the first indications were still bad.
The Dutch Labor Party of eurogroup chairman Jeroen Dijsselbloem has been punished by voters in parliamentary elections, plunging from 38 seats at the last election to just nine.
The left-leaning party appeared to be hammered by its supporters for its role over the last four years in pushing through a tough austerity package as junior member in a two-party Cabinet with the right-wing VVD party of Prime Minister Mark Rutte.
Labor Party junior Cabinet minister Sharon Dijksma called the defeat "an enormous slap for us all and I think that all social democrats this evening have a scratch on their soul."
Mr Rutte had framed the election as a choice between continuity and chaos, portraying himself as a safe custodian of the nation's economic recovery and casting Mr Wilders as a far-right radical who was unprepared to make tough decisions.
The chance of Mr Wilders becoming prime minister in the Netherlands, where a proportional representation voting system all but guarantees coalition governments, was remote, even if his party had placed first in the election.
All mainstream parties, including Mr Rutte's VVD, had ruled out working with Mr Wilders and his Party for Freedom.
Mr Wilders' one-page election manifesto included pledges to close borders to immigrants from Muslim nations, shutter mosques and ban the Koran, as well as to take the Netherlands out of the European Union.
The campaign's final days were overshadowed by a diplomatic crisis between the Dutch and Turkish governments.
It erupted over the refusal of the Netherlands to let two Turkish government ministers address rallies about a referendum next month that could give Turkey's President Recep Tayyip Erdogan more powers.
The crisis nevertheless gave Mr Rutte an opportunity to refuse to bow to foreign pressure, a stance with widespread backing in the nation.
“It is my task to keep the nation safe and stable and deal with these kinds of people,” Mr Rutte said.
Mr Rutte has driven through unpopular austerity measures over the last four years, but the Dutch economic recovery has gathered pace and unemployment has fallen fast.
Mr Wilders, meanwhile, tapped into discontent among voters who say they are not benefiting from economic recovery.
Join our commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies