ST. PETERSBURG, Russia — For more than a dozen years, it has been impossible to miss Russia’s soaring, often ostentatious, energy wealth — the flashiness of Moscow, the 250-foot yachts and the hundred-million-dollar penthouse apartments for the children. And the riches have hardly been confined to the private sector. Last year, when Vladimir V. Putin wanted to shore up support ahead of Election Day, the salaries of government workers jumped; military pay actually doubled.

Those heady days seem to be running out, however. The great gush of oil and gas wealth that has fueled Mr. Putin’s power and popularity and has raised living standards across Russia is leveling off. Foreign investors, wary of endemic corruption and an expanding government role in the economy, are hanging back, depriving the economy of essential capital.

In many respects, analysts say, the same iron fist that Mr. Putin wielded to public approval in the early years of his presidency could be the biggest obstacle to a badly needed economic restructuring, and potentially even turn public opinion against him.

Russia’s economy, the world’s eighth largest, slowed to a near standstill in the first months of this year, and the Kremlin is now preparing to dip into its $171 billion rainy day fund in a bid to spur growth. But the problems for Russia’s economy run deeper than its overwhelming dependence on oil and gas revenues, which now account for more than half the federal budget.