Denmark's center-left prime minister has resigned, paving the way for the Liberal leader to start tough talks on forming a Cabinet following the success of an anti-immigration party that lifted the center-right opposition to victory.

Helle Thorning-Schmidt, who also is quitting as Social Democratic leader, presented her resignation to Queen Margrethe at the royal palace on Friday.

The Danish People's Party that wants to limit the European Union's influence over the Scandinavian country, made large gains in Thursday's elections and overtook Lars Loekke Rasmussen's Liberal Party as Denmark's second largest party.

The bloc led by Loekke Rasmussen, a former prime minister, secured the 90 seats necessary for a majority in Parliament. To form a government, he needs to include the Danish People's Party in talks expected to start later Friday.