With all mainland votes counted, ex-PM Lars Lokke Rasmussen’s center-right group beat PM Helle Thorning-Schmidt’s center-left coalition, although her party is the largest.
Helle Thorning-Schmidt has now stood down as Social Democratic Party leader.
The right-wing, anti-immigration Danish People’s Party will become the second-largest in parliament.
The DPP’s leader Kristian Thulesen Dahl had previously poured cold water on the idea of going into government.
Kristian Thulesen Dahl told Denmark’s Politiken he preferred “the little free bird role, which can make the Danish People’s Party come closer to getting our policy through in the real world than you think”.
He could yet be in a position to make a bid to become prime minister.
In a victory speech just before 01:30 local time, Lars Lokke Rasmussen – who led Denmark between 2009 and 2011 – said: “Four years ago, we returned the keys to the PM’s office. I said that time that they were only a loan.”
He said he would push for “control of the flow of refugees”.
Helle Thorning-Schmidt’s governing Social Democratic Party was the biggest party, winning at least 26.3% of the vote, according to Danish broadcaster DR.
Her allies failed to gain as much of the vote as those of the opposition and she stood down as leader after conceding defeat.
Helle Thorning-Schmidt said she was proud to have led the Social Democratic Party to the highest percentage of the vote, adding: “We lost at the finish line.”
According to DR, the Danish People’s Party won 21.1% of the vote, and Lars Lokke Rasmussen’s Denmark Liberal Party came third on 19.5%.
Image source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…