The song about a love-struck couple was performed by 21-year-old student Eldar Gasimov and Nigar Jamal, 30, a mother-of-two who lives in London. The duo, known as Ell-Nikki, won a total 221 points.
Italy was second with 189 points and Sweden came third on 185 in the 56th edition of the contest, hosted by Germany. Widely heralded pre-contest favorites Ireland, Britain and France all had disappointing results.
The extravaganza, dubbed the world's biggest music competition with one of television's largest audiences, was beamed to countries from the Atlantic Ocean to the Caspian Sea -- and to nations around the world that were not even competing.
"Oh my gosh, we won, we won," said Gasimov, whose face was drenched with sweat as he celebrated on stage in front of 36,000 spectators in a soccer arena in the German city of Duesseldorf that had been converted for the event.
"I'm the happiest man in the world right now," he said.
The Azeri entry had Swedish touches. It was composed by Swedes Stefan Orn, Sandra Bjurman and Iain Farquharson and four Swedish dancers accompanied Ell-Nikki.
Jamal, who has an economics degree, said it was hard to grasp the fairytale victory for Azerbaijan, a former Soviet republic of eight million that regained independence in 1991.
"A few months ago I was a housewife and mother of two children -- and my biggest dream was to represent my country in the Eurovision Song Contest," she told news conference. "My dream came true: I'm a winner of Eurovision."
GLITZ AND KITSCH
The Eurovision Song Contest has been a launching pad for international careers. Swedish pop group Abba became famous after winning in 1974 with "Waterloo" and Celine Dion took top honors in 1988 while competing for Switzerland.
Many deride the contest for serving up mediocrity, while others are enthusiastic followers.
From its start in Switzerland in 1956, the contest conceived by the European Broadcasting Union has grown into a giant event where performers, often dressed in spangly costumes, belt out their songs in different languages.
Fans draped in national flags and clad in exotic outfits packed the arena, cheering the 25 finalists who mixed glitz and kitsch with ballads, rock 'n' roll and disco to try to win votes from viewers and 43 national juries.
It was also a disappointing night for Germany after Lena won last year in Oslo.
Lena became an instant national hero for ending Germany's three-decade Eurovision drought. Her song "Satellite" went to the top of pop music charts in six countries and was a top 10 hit in seven others. She was a distant 10th on Saturday night.
French opera singer Amaury Vassili, British boy band Blue and Ireland's Jedward had also been tipped as favorites by bookmakers but finished poorly.
Other famous participants in past contests included Julio Iglesias, Olivia Newton-John, Secret Garden, t.A.T.u., Lordi and Patricia Kaas. Riverdance was created in 1994 when Ireland hosted the contest.