Exit polls by broadcasters TV 2 and DR showed the left-wing bloc taking 90 of the 179 seats in parliament.
This would pave the way for the Social Democrats to form a government under party leader Mette Frederiksen.
At 41, she would be the country's youngest ever prime minister.
If confirmed, the results would end the rule of Prime Minister Lars Lokke Rasmussen's centre-right Liberal Party, which has been in power for 14 of the last 18 years.
His centre-right bloc was set to get 80 seats, according to the exit polls.
Who are the major parties?
Denmark uses a proportional representation voting system and frequently sees coalition and minority governments.
The main parties are traditionally organised into the left-wing "red bloc" and right-wing "blue bloc".
The red bloc is headed by the centre-left Social Democrats, who have spent the past four years in opposition.
During the campaign, the Social Democrats pledged to increase public spending, hike taxes for businesses and the wealthy, and partially roll back pension reforms so that people who have worked for 40 years can retire earlier.
The blue bloc is splintered into eight parties, of which three are newcomers.
The pro-EU Liberal Party (Venstre) has ruled Denmark since 2015, forming a coalition with the Conservative People's Party and the Liberal Alliance.
It became the biggest Danish party in the European Parliament last month and promised in the national elections to put extra money into the welfare system and crack down on immigration.
What were the major issues?
Welfare : Many voters were concerned over the fate of the country's cherished welfare model, which has faced years of cuts amid struggles by successive governments to deal with ageing populations. Danes pay some of the highest taxes in the world to support a generous cradle-to-grave welfare state. But they say cuts mean they are increasingly paying for services that used to be free and worry that further austerity measures could erode key services such as health care and education.
The environment: Some 57% of Danes wanted the next government to prioritise climate change, according to a Gallup poll released in February. For younger voters, aged between 18 and 35, the figure was 69%.
Immigration : Major parties on the right and left adopted anti-immigration policies. Both the Liberal Party and the Social Democrats said doing so would help to protect the welfare system.
More about: Denmark