At 41, Mette Frederiksen managed to defeat the sitting liberal Prime Minister, Lars Løkke Rasmussen, who held the office between 2009 and 2011, and again since 2015 with backing from the Danish People's Party (DF).
Frederiksen duly received the royal assent required by the Constitution of the small parliamentary monarchy.
"Her Majesty the Queen... requested the head of the Social Democrats Mette Frederiksen to lead negotiations on the formation of a new government," the Royal House announced following a meeting between the Queen Margrethe II and the politician.
The anti-immigrant and euro-sceptic DF, which has shaped Denmark's restrictive immigration policies since the early 2000s, effectively collapsed in the June 5th elections, depriving the centre-right government of its main support in Parliament.
As restrictive immigration policies have been broadly adopted by most other parties, DF lost its unique appeal with voters.
READ ALSO: How two decades of immigration curbs moved far-right politics into Denmark's mainstream
In a country where minority governments are the norm, negotiations for a new government centred around conflicting demands on climate, economic and immigration policy.
The three-week negotiations were the longest in Denmark since 1988 and resulted in an 18-page agreement between the Social Democrats and three left- and centre-left parties.
Presenting the agreement on Tuesday, Frederiksen pledged to put defence of the welfare state and action on climate change at the top of her agenda.
"It is a political document, one of the first in the world, that really defines green ambitions," she said, highlighting a key concern for voters and leftist parties.
"We will develop a climate plan, a binding law on climate and reduce greenhouse emissions by 70 percent by 2030," Frederiksen continued.
With 25.9 percent of the vote, her party retreated slightly from 26.3 percent in 2015, but remained the country's leading party. The left-of-centre ‘red bloc’ has a majority with 91 seats out of 179 in the Folketing, the Danish Parliament.
Frederiksen's government also intends to increase the number of teachers in the country and provide added financial assistance for families.
The outgoing head of government commented on Twitter that the negotiations had resulted in an expensive wish list.
"Did they forget to discuss how to pay the bill...?" Rasmussen asked.
According to the governing agreement, targeted tax increases will finance some of the expense.
Frederiksen said that while the budget had not been finalised, "every krone" needed for the identified priorities would be financed.
On immigration, the four coalition partners agreed to not make sweeping changes, but to soften some reception conditions in the name of a more "humane" policy.
Specifically, Frederiksen, who last year presented a policy proposal which included sending "non-Western" migrants to North African camps while their applications are processed, announced Denmark would again start receiving refugees under the United Nations quota system.
In 2015, Denmark reinstated border controls and suspended its participation in the UN refugee resettlement quota programme in 2016.
The new agreement abandons a policy where "undesirable" migrants, rejected asylum seekers with a criminal record awaiting expulsion, and those who cannot be sent back to their country, would be placed on an uninhabited island.
READ ALSO: New Danish government to scrap plans for 'deserted island' deportation facility
Kasper Hansen, Professor of Political Science at the University of Copenhagen, told AFP the new government is "not changing the general access to Denmark for migrants," and "the law won't change" on this issue".
Professor Rune Stubager from Aarhus University said the "focus" seemed to have changed a bit from repatriation of rejected migrants towards integration.
But he added "this may mostly be a matter of semantics".
Frederiksen has repeatedly reiterated her intention to broadly continue the strict approach to immigration of the previous government, including a general policy to repatriate refugees once their home countries are deemed safe enough.
The new PM will likely present her new government on Thursday.
READ ALSO: What you need to know about Denmark’s new government agreement