The star, who last won the competition in 2012, saw off competition from Finland's Käärijä in a nail-biting vote.
The UK's Mae Muller failed to replicate Sam Ryder's success last year, coming in 25th place - one above bottom.
And the Princess of Wales made a surprise cameo, playing the piano with last year's winners Kalush Orchestra.
Loreen is only the second person - and the first woman - to win Eurovision twice, following Ireland's Johnny Logan.
"This is so overwhelming," she said as she collected the trophy. "I'm so grateful. I'm so thankful."
"In my wildest dreams, I didn't think this would happen."
Sweden's victory means it will host next year's competition - on what will be the 50th anniversary of Abba's historic victory with Waterloo in 1974.
But Ireland crashed out of this year's contest at the semi-final stage for the fifth year in a row - a result their head of delegation described as "devastating".
Saturday's final on BBC One was watched live by an average of 9.9 million viewers across the programme, with a peak of 11 million.
Last year, a peak audience of 10.6 million tuned into see Sam Ryder go close in Turin.
Across measured territories, last year's contest reached 161 million people across its three live shows - and producers were hopeful of topping that this year, with the show being seen in all 37 participating countries, as well as Belgium, Chile, Kosovo, North Macedonia, and the US.
The viewing figures fell short of the King's Coronation the previous weekend, when an average audience of 18 million tuned in.
This year's top three acts were:
1. Sweden: Loreen - Tattoo (583 points)
2. Finland: Käärijä - Cha Cha Cha (526 points)
3. Israel: Noa Kirel - Unicorn (362 points)
Mae Muller only picked up 24 points, leaving the UK near the bottom of the leaderboard. It was "not the result we hoped for," she tweeted after the show.
"I know I joke a lot but we really put our all into the last few months," she said. "Congrats to all the countries, I'll never forget this journey and I love you all."
Liverpool hosted this year's contest on behalf of war-torn Ukraine, which won in 2022.
Appropriately, the show began with last year's winners, Kalush Orchestra, playing an extended version of their song Stefania in a pre-taped segment from Kyiv.
Stars including Joss Stone, Sam Ryder and Andrew Lloyd Webber added a British flavour to the song, as the band boarded a train from Kyiv's iconic Maidan Nezalezhnosti metro station and arrived on the stage of the Liverpool Arena.
The Princess of Wales accompanied on piano, in a brief segment recorded in the crimson drawing room of Windsor Castle earlier this month.
Back in the arena, Kalush performed their new single Changes, delivering a message of defiance to Russia: "Give my all down to the wire / Set me free."
It was the first of many references to the war, in a show that took a more political tone than most editions of Eurovision.
Croatia's Let 3! performed a song that referred to Russia's Vladimir Putin as a "crocodile psychopath", while the Czech band Vesna sang in Ukrainian, "We're with you in our hearts".
Ukraine's own entry, Tvorchi, played a powerful song inspired by the siege of Mariupol.
The duo's hometown of Ternopil was hit by Russian missiles moments before the band took to the stage in Liverpool, officials said.
They eventually took sixth place, with a total of 243 points.
Russia has been suspended from the contest due to the invasion, but organisers refused to allow a speech from Ukraine's President Volodomyr Zelensky during the show.
Elsewhere, Eurovision was Eurovision. There were 80s-inspired tributes to Miami Vice, a ghost story about Edgar Allen Poe and, naturally, a tear-away dress.
But the musical component of the contest continues to improve.
Spain's Blanca Paloma combined traditional flamenco rhythms with a throbbing electro pulse on the vibrant, urgent EAEA; and France's La Zarra tied together decades of Gallic music history in the Piaf-meets-Daft-Punk Évidemment.
Acts from Armenia, Poland and Israel - especially Israel - threw slick dance breaks into their performances; while Italy's Marco Mengoni was accompanied by two gymnasts on trampolines.
There was also the usual surfeit of tortured ballads, both good (Lithuania) and drab (Albania); and a never-ending parade of lyrics about coming together and being nice to your neighbours (Belgium, Switzerland, Australia).
Finnish rapper Käärijä was the runaway public favourite, receiving more than Loreen's tally in the phone vote. But his chaotic mix of thrash metal, hardcore techno and K-pop melodies failed to impress the juries, who are comprised of music experts.
In a post-modern twist, the competition was bookended by two songs about the process of songwriting.
Austrian duo Teya & Salena kicked off the show with the quirky pop anthem Who The Hell Is Edgar, in which they are possessed by the spirit of US poet Edgar Allen Poe, who compels them to write a song.
An hour-and-a-half later, Mae Muller closed the competition with I Wrote A Song - in which she gets revenge on her ex-boyfriend by writing a song that catalogues his misdemeanours.
It meant the contest opened with the lyric, "Oh my God, you're such a good writer", and ended with Muller singing, "Instead, I wrote a song".
And if that's not synchronicity, I don't know what is.
The contest was presented by Alesha Dixon, Hannah Waddingham and Ukrainian singer Julia Sanina, with Graham Norton joining them during the voting stage.
The interval showcased the "Liverpool songbook" with tracks by John Lennon, Melanie C and Gerry and the Pacemakers performed by former Eurovision contestants.
And Sam Ryder, who came second for the UK last year, performed an emotional version of his new single, Mountains, with Queen's Roger Taylor on drums.
Ryder, whose song is about overcoming adversity, was accompanied on stage by dancers who had lost limbs.
Loreen easily won the jury vote, picking up the maximum 12 points from Ireland, Estonia, Spain, Albania, Cyprus and Ukraine, among others.
She ended the jury sequence with a score of 340, giving her a comfortable 163-point lead over Italy's Marco Mengoni.
The public preferred Finnish rapper Käärijä, with his total of 526 points temporarily putting him in the lead.
After a tense pause, Loreen reclaimed the crown at the last minute, receiving a public score of 243 that put her back on top.
The UK languished at the bottom of the table, picking up just nine points from the public and 15 from the juries.
Only Germany fared worse. Their glam-rock song Blood And Glitter gained a mere 18 points.
Commiserations came from the BBC, who organised the contest in partnership with the European Broadcasting Union.
The broadcaster's official Twitter account posted: "Mae, we're so proud of you and everything you've achieved at this year's Eurovision Song Contest."