SOCHI, Russia — The 2014 Winter Olympics ended peacefully and dramatically on a beautiful early spring night Sunday, a welcomed counterpoint to the tension-filled start three weeks ago.

After two-and-a-half weeks of daredevil snowboarders, graceful figure skaters and stamina-defying cross-country skiers giving it their all, Sochi bid adieu in a closing ceremony that offered a salute to Russian culture. And a strong kick to the finish also gave the hosts the top final medal tally with 33, the U.S. finishing second with 28.

Like stepping into David Lean’s “Doctor Zhivago,” the production in Fisht Olympic Stadium along the Black Sea showcased Russia’s musical and balletic gifts to the world.

For example, producers offered Rachmaninov’s “Piano Concert number 2,” featuring 62 pianos, and a collaboration with the famed Bolshoi and Mariinsky ballet.

The Russians wanted to present something elegant and subdued. Four hours before the show, two Bolshoi dancers told a foreign visitor they would “try their best to please you tonight.”

They didn’t need to sweat it after their stunning performance rekindled memories of the Russian Olympic figure skaters who twirled their way into the hearts of their compatriots this month.

“The Games have turned our country, its culture and the people into something that is a lot closer and more appealing and understandable for the rest of the world,” said Dmitry Kozak, Russia’s deputy prime minister.

Before the traditional handoff to the next Winter Olympics host city — Pyeongchang, South Korea — Sochi offered a final parting present to skeptical guests.

“Tonight, we can say, Russia delivered all what it had promised,” International Olympic Committee president Thomas Bach told the audience of 40,000. “What took decades in other parts of the world was achieved here in Sochi in just seven years.”

Bach thanked Russian President Vladimir Putin “for his personal commitment” to ensure the Games came off as planned. Putin, a visible presence during the Olympics, attended the ceremonies.

Despite talk of terrorist threats, anti-gay legislation and unfinished hotels, Sochi organizers pulled it together in the most expensive Games in history at an estimated $50 billion. In the end, they rebuilt the Russian Riviera into a modern sea and mountain resort that they hope becomes a major tourist destination.

“It was a race to the finish for Sochi,” said Scott Blackmun, chief executive of the U.S. Olympic Committee. “I was here more than a year ago and it is amazing what they have done, not just with the volume of construction. They didn’t spare anything.”

The success led to self congratulations that could be justified.

“It was a great moment in history, a moment to cherish and pass on to the next generation,” Sochi organizing president Dmitry Chernyshenko told the crowd. “This is the new face of Russia.”

The so-called “Iron Ring” of security around this southern frontier dissuaded the terrorist threats that scared away some Western fans and led to a soulless Olympics lacking in international spirit usually associated with the Games.

But the strong domestic support shined through despite the abject failure of the motherland’s hockey team, which lost to Finland in the quarterfinals. Russian fans had plenty to celebrate: 33 medals, including four on the final day with the men sweeping the 50-kilometer cross-country mass start and Siberian bobsledder Alexander Zubkov winning the four-man race.

Russia topped the table for total medals and gold medals (13). The United States was second in total medals with 28, but only fourth in gold medallions with nine.

Norway won 26 medals — 11 gold — and Canada 25.

The United States had its best Winter Olympics showing outside North America despite nine fewer medals than in 2010. Although speedskating had a disastrous run with one medal in long- and short-track racing, the action sports kept America near the top. U.S. athletes won eight of 18 medals in the new freeskiing and snowboarding events.

“If you look at things broadly, the medals are getting spread around more,” the USOC’s Blackmun said. “The fact we are still top of the medal table is indicative that things are alive and well in the U.S.”