Austrian drag queen Conchita Wurst, popularly known as "the bearded lady," won the Eurovision Song Contest with the James Bond-theme-like ballad "Rise Like a Phoenix", before a global TV audience of about 180 million people in 45 countries.
Malta's representative, Firelight singing the song Coming Home, gave a confident performance but failed to get points from the majority of countries, finishing off 23rd with a total of 32 votes.
Malta got the most votes from the UK (10). Azerbaijan and the Netherlands gave Malta five points, San Marino, four; Ireland and Finland, three, and Albania and Italy one.
Malta gave its 12 votes to Italy. It also voted for Austria (10), Romania (eight), Sweden (seven), Armenia (six), Russia (five), the United Kingdon (four), Switzerland (three), Norway (two), and Greece (one).
Young Gaia Cauchi, the Maltese winner of the Junior Eurovision Song Contest, made a brief appearance as a guest during the show.
Wurst, sporting high heels, butterfly eyelashes and a full beard, topped the Netherlands' modern-country duo the Common Linnets, who sang "Calm After The Storm". Sweden's Sanna Nielsen came in third with her new-age pop song "Undo".
"For me, my dream came true," Wurst, 25, whose birth name is Tom Neuwirth, told a news conference after the win. "But for our society, it just showed me that there are people out there who want to go into the future and go on, you know, not stepping back or thinking in the past."
The Danish organizers had declared tolerance a main theme for this year's event, and the rainbow-coloured flag symbolising gay pride has been flying in many places in Copenhagen during the past week.
"I hope we can change just a few minds," said Wurst's agent René Berto. "It is just a lady with a beard. But it is like we have landed on the moon."
Wurst, Austria's first Eurovision winner since 1966, received the biggest cheers from the audience but also stirred controversy in some countries.
Online petitions were started in Belarus, Armenia and Russia - whose government passed a law last year banning "gay propaganda" among minors - to have Wurst removed or edited out of broadcasts in their countries.
"We did it. It is the most amazing thing. But I knew she would win. I just knew it," Austrian fan Damel Saric told Reuters. "I have travelled to Copenhagen just for this moment."
The Eurovision competition, which has been held annually since 1956, was created to help foster unity after World War Two and is meant to be non-political. But political strife slipped between the cracks at this year's contest.
Many in the audience booed when the Russian contestants, the 17-year-old Tolmachevy twin sisters, were presented at Saturday's opening ceremony and again when they were awarded points from other, mostly neighbouring, nations.
It was widely speculated that Russia's entry could suffer for the country's annexation of Crimea in March and the government's intransigence on gay rights. Eurovision is hugely popular in the gay community.
"The two Russian girls are sweet, and it is not their fault. But this is a party for everybody. Russia doesn't get that," said one of the booing spectators, a gay Dutch fan who identified himself as Xander.
Ukrainian singer Mariya Yaremchuk, 21, got huge cheers at her performance.
"It could be in the favour of Ukraine, that people vote for Ukraine and people don't vote for Russia because they don't like the political situation," said another Dutch fan, Patrick Van Der Ploeg.
Adding to controversy, organisers said votes from Crimea count as Ukrainian votes, because tallies are based on existing national telephone codes.
Ukraine's song was voted the sixth best of the 26 songs, and Russia's came in at seventh.
Since politics had played a role in the voting in the past, half the points are now awarded by professional judges and half by the public via phone and SMS.