Sochi defeated the South Korean city of Pyeongchang 51-47 in the final round of voting by the International Olympic Committee.
Fireworks boomed in the sky to celebrate Sochi's selection and Russians' feeling of confidence that their long-beleaguered land has finally overcome its troubles.
Tamara Zaporozhets, a 24-year-old curtain designer, gave the sentiment some cocky street spin: "We are the best in the whole world. Sochi rocks!"
Russia, which hosted the 1980 Moscow Games, has never held a Winter Olympics.
Two previous tries by Sochi failed. A bid for the 1998 games was withdrawn amid the economic deterioration of the last months of the Soviet Union's existence. Its try for the 2002 games didn't make the final round, due to concerns about the almost-total absence of facilities.
Sochi still must build almost everything for 2014 from scratch. But this time, bid promoters pushed that as an asset, saying the new construction would mean the Olympic movement would get its most modern games ever.
The can-do attitude was bolstered by President Vladimir Putin, whose government has undertaken a program to spend billions of dollars developing the Sochi region.
Putin capped his influential backing with an impressive appearance before the International Olympic Committee hours before the vote, making lengthy remarks in English — a language to which he usually limits himself to only a few sentences. He added some passable French, too.
"Our president is the best!" exclaimed Sochi resident Ana Malashenko after the vote announcement.
The Austrian resort of Salzburg was eliminated in the first round of the secret ballot, setting up the decisive head-to-head contest between Sochi and Pyeongchang.
Pyeongchang led the first round with 36 votes, followed by Sochi with 34 and Salzburg with 25. Sochi picked up 17 votes in the second round to secure the victory.
The result was a triumph for Putin, who put his international prestige on the line by coming to Guatemala to lobby IOC members and lead Sochi's final formal presentation to the assembly. Putin had left by the time the result was announced.
IOC president Jacques Rogge opened a sealed envelope and read the words the Russians longed to hear:
"The International Olympic Committee has the honor of announcing the 22nd Olympic Winter Games in 2014 are awarded to the city of Sochi."
Russian delegates in the hall erupted in cheers, jumped to their feet and hugged each other. They unfurled a Russian flag and chanted, "Sochi! Sochi!" Korean delegates bowed their heads, some in tears.
"It was a historic decision for all countries," Sochi bid chief Dmitry Chernychenko said. "Russia will become even more open, more democratic."
In Sochi, cheers erupted from the crowd of more than 15,000 that had gathered for a pop concert and the announcement in a main square.
"We did it all together. We won," the concert's announcer said from the stage as fireworks flashed and boomed in the sky.
People hugged and waved their hands in the air. Some appeared to have tears in their eyes.
"It is great. I've never been so happy in my life," said Marina Matveyeva, 23, who works in a bank. "It means that Russia has reached the level of Europe, and we can be proud of our country."