UEFA President Michel Platini announced the surprise decision in Cardiff, Wales.
Poland and Ukraine beat out Italy and a second joint bid, from Croatia and Hungary, to stage the finals.
Italy, the 2006 World Cup champions, gained only four votes from UEFA's executive committee, compared to eight for Ukraine.
Italy's bid had been favored to win. But the country's reputation as a soccer superstar has been hurt by a string of scandals and violent incidents.
The Croatia-Hungary bid failed to win a single vote.
Politics No Obstacle
There had been fears that the current political crisis in Kyiv would hurt the Ukraine-Poland bid.
A deadlock continues between President Viktor Yushchenko, who earlier this month issued a decree dissolving parliament following allegations that his rival, Prime Minister Viktor Yanukovych, had poached opposition deputies to add muscle to his ruling coalition.
In the end, however, the standoff failed to sink the country's joint UEFA bid with Poland.
"We thought the political situation could hamper our bid. There were such speculations circulating in UEFA's corridors," Volodymyr Lashkul, the vice president of the Ukrainian Football Federation, told Reuters. "But that didn't happen. The two presidents who came to the presentation yesterday -- Viktor Yushchenko and [Polish President] Lech Kaczynski -- made a breakthrough in the situation."
Long Road Ahead
The decision will put Ukraine's financial and tactical resources to the test. Before 2012, the country will need to either renovate or construct from scratch six professional-standard soccer stadiums.
The Ukrainian cities of Kyiv, Donetsk, Dnipropetrovsk, and Lviv have been chosen as match sites. Additional matches may also be played in Kharkiv or Odesa. Six cities in Poland have also been selected for matches.
Among the Ukrainians in Cardiff celebrating today's decision was boxing legend Vitaliy Klychko (whose surname is often spelled "Klitschko" in the West), who served as a member of UEFA's Ukrainian delegation.
Klychko told RFE/RL's Ukrainian Service that the 2012 European Championship will be "the most important sporting event" in Ukrainian history, and was a "great responsibility."
"This will have great economic repercussions," he said. "This will influence the development of our infrastructure, the tourist infrastructure, the sporting infrastructure. This will be a very significant step for us in terms of European integration."
Klychko acknowledged that an enormous amount of work lies ahead as the country readies itself to host one of the world's most popular sporting events. But was optimistic that it could be done.
"To be perfectly honest, we need to build hotels. We need to build airports. We're already building new contemporary stadiums in Dnipropetrovsk and Donetsk. We need to do the same in Lviv and Kyiv,” he said. "We need to do an awful lot and not that much time is left -- 4 1/2 years. But I'm confident we can do this. We have the time to do this."
It will be the first time that either Poland or Ukraine has hosted a major football championship.
The decision is seen as a significant boost to the sport in Eastern Europe.
Next year's Euro 2008 finals will be jointly held by Austria and Switzerland.
Ukraine And European Energy Security
MURKY CONNECTIONS. A year after the so-called gas war between Moscow and Kyiv, energy transhipments from Russia to Europe via Ukraine remain a concern. On December 1, RFE/RL's Washington office hosted a briefing featuring Tom Mayne, an energy researcher for the London-based Global Witness. Mayne discussed the lack of transparency in the energy sectors of Ukraine, Russia, and gas supplier Turkmenistan.
LISTEN
Listen to the entire briefing (about 60 minutes):
RELATED ARTICLES
Neighbors Watch As Russia Moves Toward WTO Membership
Kyiv Announces Terms Of New Russian Gas Deal
Former U.S. Ambassador Says Kyiv Can Cope With Gas Price Rise