Loreen, 28, wowed voters with a catchy dance number called "Euphoria" featuring an upbeat chorus accompanied by a high-kicking dance duet and a storm of artificial snow.
The victory brings Eurovision back to one of its heartlands. Sweden's most famous band Abba gained worldwide fame after winning the contest in 1974 with "Waterloo" – for many the song that defined the kitschy contest for all time.
Second place on Saturday went to Russia's heartwarming Buranovskiye Babushki, a choir of elderly women from a village who performed a disco song "Party for Everybody" in English and their local Finnic language with a stove and a tray as props.
Third was Serbian Eurovision veteran Zelijko Joksimovic who had already competed in three previous contests, once as a singer and twice as a composer.
Eurovision is the biggest event ever hosted by energy-rich Azerbaijan as it seeks to present a glitzy front to the world despite the intolerance of dissent and opposition under the rule of the Aliyev dynasty.
The host entry Sabina Babayeva was not all that far from securing a repeat of Azerbaijan's 2011 success that earned the nation the right to host the contest with her "When the Music Dies" coming in fourth.
There was disappointment however for Britain after veteran crooner Engelbert Humperdinck – brought in to revive its notoriously bad Eurovision fortunes – who scored just 12 points and came second last with his ballad "Love Will Set You Free".
The final's 26 acts lit up the spectacular Crystal Hall built to host the contest in barely half a year on the Caspian Sea, with an audience of some 20,000 inside the venue and 100 million television viewers.
Loreen ran into controversy during the contest by meeting rights activists who briefed her on the lack of democratic freedoms in the tightly controlled ex-Soviet state hosting the show.
She declined to comment on her views on human rights at a news conference on Thursday, while local opposition media reported that state television in Azerbaijan gave a bland mistranslation of the question.
A moderator at the news conference was booed by journalists after he criticised the journalist who asked the question, saying that she was ruining the mood of the show.
The show itself included the usual range of the weird and exotic including a Norwegian rapper of Iranian origin who came last, half-naked French gymnasts and an Albanian entry with a song solely in her native language and a truly terrifying top note.
The festive atmosphere was clouded by the detentions of dozens of opposition activists who attempted to hold several peaceful demonstrations calling for democratic freedoms in the tightly-controlled state.
The Public Chamber opposition alliance said that more than 60 protestors were detained Friday in the latest protest and a court sentenced three protesters to jail terms of five or six days.
Azerbaijan is run by strongman President Ilham Aliyev, who succeeded his late father Heidar Aliyev in 2003.
His wife Mehriban Aliyeva heads the organising committee and his son-in-law, Emin Agalarov, a Moscow-based businessman who has also launched a pop career, sang in a black leather jacket in a musical interlude after the voting.
Radio Liberty reported this month that a construction company involved in the project to build the Crystal Hall venue in a city-commissioned project had links to the Aliyev family.
The event was also far beyond the reach of ordinary Azerbaijanis, with tickets for the final starting at 160 manat (US$204), half the monthly income of the average Azeri according to World Bank statistics.
With political sensitivities never far from this Eurovision, the promotional videos shown included landscapes from Nagorny Karabakh, which Armenian separatists backed by Yerevan seized from Azerbaijan in a war in the 1990s.
Armenia had pulled out of the contest saying it feared hostile treatment and Azerbaijan barred those who had visited Nagorny Karabakh from travelling to the contest.