Russia’s invasion of Ukraine risks fueling inflation and sapping growth world-wide, but a handful of nations are in line for an export windfall thanks to soaring energy and commodity prices.

Countries including Canada, Australia and energy-rich Gulf Arab states look set to benefit as the invasion sparks record rallies in commodities from oil and gas to nickel and palladium.

Prices...

Russia’s invasion of Ukraine risks fueling inflation and sapping growth world-wide, but a handful of nations are in line for an export windfall thanks to soaring energy and commodity prices.

Countries including Canada, Australia and energy-rich Gulf Arab states look set to benefit as the invasion sparks record rallies in commodities from oil and gas to nickel and palladium.

Prices have surged as investors judge that Western sanctions and logistical disruptions could choke off Russia’s abundant supplies of oil, gas, grains, metals and fertilizers, while the war has disrupted Ukrainian and Russian exports of food staples such as wheat and sunflower seeds.

Most of the world can be counted as economic losers from the conflict, with galloping food and energy prices set to push up inflation from Asia to Europe and the U.S., squeezing household budgets just as economies were beginning to put the worst of the pandemic behind them. Factories face higher raw material and shipping costs.

Even those economies in line for a boost from higher commodity prices will likely face inflationary pain, and some may struggle to rapidly expand production to reap any durable benefit from higher prices.

“Our terms of trade will rise over the months ahead, which will provide a boost to our national income,” Reserve Bank of Australia Gov. Philip Lowe said in a speech in Sydney Wednesday. He said most of the lift will come through higher corporate profits and tax revenue, but said he also expects rising prices to eat into household budgets and push up costs for businesses outside the resources sector.

Philip Lowe, governor of the Reserve Bank of Australia, said he expects rising prices to eat into household budgets and push up costs for some businesses.

Photo: Brent Lewin/Bloomberg News

Russia is the world’s 11th largest economy, a major supplier of energy to Europe and an important source of metals used in factories world-wide. It produces around 40% of the world’s palladium, used in catalytic converters and semiconductors; around 10% of the world’s nickel, used in stainless steel and for batteries; and industrial staples such as aluminum, according to the U.S. Geological Survey.

The country is now subject to a sweeping package of financial sanctions by the U.S., the European Union and others aimed at crippling its economy and dislodging it from Ukraine.

Oil prices have risen sharply in recent days, with the global benchmark Brent crude breaching $130 a barrel earlier this week, its highest level since July 2008.

Rising oil prices are good news for major producers such as Saudi Arabia, where the oil-and-gas sector accounts for about 50% of gross domestic product, according to the Organization of the Petroleum Exporting Countries, or OPEC, and Iraq, where oil finances 85% of the country’s budget, according to the World Bank.

If oil averages $100 per barrel or higher in 2022, Saudi Arabia, for instance, will likely swing to a double-digit fiscal surplus relative to GDP, from a 4.9% deficit in 2021, said Monica Malik, chief economist at Abu Dhabi Commercial Bank. Such fiscal windfalls would give the Gulf states extra resources to finance megaprojects such as the futuristic city-state called Neom that Saudi Crown Prince Mohammed bin Salman wants to build, as well as infrastructure linked to the post-oil economy including renewables, hydrogen, ammonia exports and carbon capture projects.

Related Video: Surge in Oil Prices Could Drive Inflation Even Higher

Russia’s attack on Ukraine helped push the price of oil to over $100 a barrel for the first time since 2014. Here’s how rising oil costs could further boost inflation across the U.S. economy. Photo illustration: Todd Johnson The Wall Street Journal Interactive Edition

“A fat cash infusion is just the ticket to pay for the Gulf’s big plans to diversify their economies without antagonizing anyone with new taxes,” said Jim Krane, energy research fellow at Rice University’s Baker Institute. He added the flip side will likely be higher inflation.

The surging oil price is also a fillip for the energy sector in the U.S., as well as U.S. antagonists such as Iran and Venezuela, who rely on oil to fill government coffers. U.S. suppliers of liquefied natural gas such as

Cheniere Energy Inc. and Cameron LNG are already supplying record amounts of the fuel to starved European markets.

Surging prices for metals and other commodities the Russians produce will similarly bring windfalls for rival producers. Many are developing economies laid low by the pandemic, such as South Africa, a big producer of palladium, platinum, gold and diamonds.

Indonesia and the Philippines are the world’s first and second largest producers of nickel, respectively, according to the U.S. Geological Survey. The price of nickel on Tuesday had more than tripled in a week, at one point reaching a record $100,000 a metric ton.

Sheets of nickel. The price of nickel has risen in recent days, at one point reaching a record $100,000 a metric ton.

Photo: EVGENIA NOVOZHENINA/REUTERS

Among advanced economies, Australia and Canada look set to be the biggest beneficiaries of the squeeze on commodities from both Russia and Ukraine. Both countries export energy, wheat and metals, while Canada is also a major producer of potash, a fertilizer, and canola oil and seed, used to make animal feed and vegetable alternatives to sunflower oil.

“Canada is in a very good position,” said Benjamin Tal, an economist with CIBC Capital Markets, a Toronto-based investment bank. Consulting firm Capital Economics predicts rising commodity prices will help push Canada’s goods trade surplus to its widest on record in March, of around 5 billion Canadian dollars ($3.9 billion).

Russia has said it may have to stop exports of fertilizer because of difficulties getting it out of the country, while sanctions against its ally Belarus, one of the world’s biggest exporters of potash, has effectively halted its exports to Europe, a major market.

A spokesman for Canadian fertilizer giant Nutrien Ltd. said it expects to increase its production of potash this year by 700,000 metric tons from 13.6 million metric tons produced in 2021. Nutrient will ensure “customers get what they need,” he said. Nutrien’s share price is up by around 30% since the war began.

Piles of refined potash sit in a storage barn at a Nutrien facility in Canada, which is a major producer of the fertilizer.

Photo: James MacDonald/Bloomberg News

Still, meeting global demand amid supply disruptions won’t be easy, adding to inflationary pressures. Canadian grain growers have limited capacity to help make up for disruptions in Ukraine because they are recovering from poor crop yields last year. Many Canadian wheat and canola farmers have presold their planned crops for 2022 as they seek to recover financially from sharp declines in production after drought conditions in Western Canada, said Dave Quist, executive director of the Western Canadian Wheat Growers.

Canadian wheat and canola stocks were down roughly 40% by the end of 2021, according to Statistics Canada. Mr. Quist said stocks that haven't been presold could be difficult to ship to typical buyers of Ukrainian crops in the region. “It’s a very fluid situation,” he said.

Canada holds the fourth-largest oil reserves in the world but the country’s producers haven’t invested in new projects because of public and regulatory opposition to development on environmental grounds.

SHARE YOUR THOUGHTS

Which countries do you think stand to benefit from global sanctions? Join the conversation below.

Economists caution that even if commodity exporters benefit from rising prices for their exports, the overall economic effects could be muted by the inflationary consequences for domestic consumers. The Philippines, for instance, produces a lot of nickel but it imports a lot of energy, making it especially sensitive to higher global oil prices, according to Citi.

Egypt is a gas producer, but it is also the world’s biggest importer of wheat, most of which it gets from Ukraine and Russia. If wheat was to rise by 50% this year, Egypt’s import bill would increase by around 0.2% of GDP, according to Capital Economics.

While Canada’s GDP will rise by 0.2% because of this conflict, interest rates are now likely to jump to 2% this year from their current 0.5% level, according to BofA Securities.

Beyond Russia and Ukraine, the biggest economic hit from the war is likely to be felt in Europe, which is closest to the conflict and heavily reliant on Russian energy. The EU, which gets 40% of its natural gas from Russia, doesn’t have the counterbalance of a large domestic commodity sector to reap in current higher profits.

Crude oil prices have risen sharply in recent days, helping to push up gasoline prices.

Photo: Jill Connelly/Zuma Press

The U.S. economy is likely to fare better given its role as the world’s top oil producer and still-sizable household savings, but even there, the hit from inflation is likely to weigh on consumer spending and growth. Federal Reserve Chairman Jerome Powell in early March told lawmakers that he would propose a quarter-percentage-point interest-rate increase at this month’s policy meeting, effectively ending speculation over a larger rate increase.

Much depends on how long the war in Ukraine lasts and if relations between Russia and the West get any worse.

“If the tensions are prolonged or escalate further, the markdowns to this year’s growth outlook may need to be denominated in percentage points,” Citi economists Nathan Sheets and Aaron Liu said in an assessment of the conflict’s possible economic effects published Tuesday. “Alternatively, if the stresses ease in coming months, there may be scope for the global economy to bounce back and, perhaps, even make up some lost ground.”

Write to Alistair MacDonald at alistair.macdonald@wsj.com, Vipal Monga at vipal.monga@wsj.com and Jacquie McNish at Jacquie.McNish@wsj.com