A Western price cap on Russian oil meant to curb Moscow’s war spending is increasingly losing its punch.

The latest evidence: Oil and gas tax revenue to the Russian budget in October more than doubled from September and rose by more than a quarter from the same month last year, according to data released Friday. That represents a stark turnaround from the beginning of the year when energy revenues tumbled.

The price cap, imposed last December, was supposed to achieve twin goals: ensure the flow of Russia’s crude on world markets, thus keeping gasoline prices low, while reducing Moscow’s revenue for each barrel it sells.

But after the sanctions initially worked largely as expected, Moscow has found ways to circumvent them, moving oil on a fleet of aging tankers on which the restrictions have limited traction. The discount at which it sells its oil relative to global prices has shrunk, boosting Russia’s war chest.

U.S. officials are scrambling to shore up their experimental intervention in global oil markets. The Treasury Department levied penalties against two tankers for violating the sanctions’ rules for the first time last month, and the U.S. is preparing additional ways to ensure traders comply with the rules, people familiar with the deliberations said.

With much of the Russian oil trade now happening outside their jurisdictions, the U.S. and its allies are also discussing ways to make it more expensive for Russia to grow and operate the flotilla of ships it uses to skirt the sanctions, the people said. The Justice Department is conducting a broad effort to crack down on violations of sanctions on Russian energy.

The size of the shipping fleet at Russia’s disposal has ensured that most of its exports aren’t subject to the cap, some analysts say.

“The price cap worked as designed, but now is obsolete,” said Natasha Kaneva, head of commodities strategy at JPMorgan Chase.

The recent influx of oil revenues helps reduce Russia’s budget deficit. Economists now think it is possible the government will hit its deficit target of 2% of gross domestic product. In the spring, some economists expected a deficit of as much as 5% to 6% this year.

The narrowing of the deficit eases some of the strain on the government’s financing requirements by reducing the need to run down savings and issue expensive bonds. As exports rise, the improvement in Russia’s trade position is helping to reduce some of the downward pressure on the ruble, which has stabilized against the dollar in recent weeks.

The rise in Russian oil prices suggests the cap is increasingly unenforceable, the World Bank said in a recent report.

The new oil bonanza helps Moscow fund its war in Ukraine and shore up its sanctions-stricken economy, the World Bank and other economists said. Next year, the government plans to increase military spending by nearly 70% to a post-Soviet record of more than $100 billion.

“It looks like the energy windfall will allow the government to step up its war effort without additional financing strains,” said Liam Peach, senior emerging-market economist at Capital Economics.

Russian officials are already taking a victory lap. “I hope that now everyone is convinced that the tool [the G-7] came up with is simply ineffective and end consumers suffer from it,” Deputy Prime Minister Alexander Novak said in October, according to the Russian news agency Interfax.

Even with Russian revenue climbing again, Treasury officials argue that the price cap has diverted resources from Moscow’s war effort by forcing Russia to build its own shipping infrastructure outside the net of Western sanctions.

“Buying tankers makes it considerably harder for the Kremlin to buy tanks,” Eric Van Nostrand, acting assistant secretary for economic policy at the Treasury, said at a recent Brookings Institution event. He said more vigorous enforcement of the sanctions would force Moscow either to sell more oil under the cap or to spend more money on the logistical system needed to sidestep them.

The U.S. has offered a list of recommendations to port managers that could raise costs for Russia, including requiring boats to prove they have properly capitalized insurance to sail in their waters, though it is unclear if foreign shipping officials will follow the U.S. suggestions.

The price cap works by allowing Western companies to transport, trade or insure Russian oil only if it is sold at or below $60 a barrel, or else face penalties from the U.S. and its allies.

Russian oil companies and their trading partners responded by assembling their own shipping network. According to research by the Kyiv School of Economics, Russia had a shadow fleet carrying oil and oil products from Russian ports consisting of 180 tankers as of September. Its biggest customers, China, India and Turkey, don’t observe the Western price cap.

Currently, over half of Russia’s crude-oil exports are shipped with non-G-7 insurance, up from around 35% in January, according to data from S&P Global.

Argus Media, a commodities-data provider, estimates that Russia’s main flavor of crude, Urals, recently traded around $74 a barrel. That is still at a discount to Brent, the global benchmark, which trades for roughly $88, though the gap between the two has narrowed considerably in recent months.

Traders got around the cap on oil prices in part by artificially inflating the cost of shipping, according to analysts at the Center for Strategic and International Studies. They said the documentation on which the sanctions rely—paperwork called an attestation, which pledges that a trade complies with the cap—is difficult to enforce.

“The effectiveness of the price cap has waned, but it doesn’t mean it’s beyond repair,” said Maria Shagina, research fellow at the International Institute for Strategic Studies.

She said that Western officials should improve enforcement by introducing strict liability for price-cap violations, tightening documentation requirements to prevent attestation fraud, and investigating inflated shipping and insurance costs.

Write to Georgi Kantchev at georgi.kantchev@wsj.com, Joe Wallace at joe.wallace@wsj.com and Andrew Duehren at andrew.duehren@wsj.com