The draw, hosted by Leyla Alieva and Nazim Huseynov, involved officials drawing the 37 Eurovision countries' names from six pots and took place on the stage of the Buta Palace in Baku, Azerbaijan on Wednesday.
According to the official Eurovision Song Contest website, the selections of countries in each pot were based on voting patterns from the past few years of the music competition.
After the draw, there were performances from dancers and an orchestra, together with past Eurovision stars Ruslana, Aysel, Alexander Rybak, Safura, Lena and Ell/Nikki.
The countries who have already qualified for the final include the UK, Germany, France, Italy, Spain and hosting country Azerbaijan. There will be another draw in March at the Heads of Delegation meeting to decide the starting order of the songs.
The countries will perform in the following groups in the Eurovision Semi-Finals:
First Semi-Final, Tuesday 22nd of May (18 countries):
Second Semi-Final, Thursday 24th of May (19 countries):
Bosnia & Herzegovina
> Jedward: 'We want to represent Ireland in Eurovision 2012'
Watch Jedward perform 'Lipstick' at Eurovision 2011: