Minnesota has emerged as an economic powerhouse as shakier finances and slumping prices for oil and agricultural commodities jolt the budgets of neighboring states.

Minnesota’s projected surplus of nearly $2 billion and a record rainy-day fund have left the state better poised to weather an economic downturn than the Dakotas, Iowa and Wisconsin, experts said. This is a dramatic change from a couple of years ago, when Minnesota was envious of North Dakota and the then-soaring oil prices that poured money into that state.

“Minnesota is doing obviously much better from a budget perspective than the rest of the Midwest,” said Dan White, a senior economist for Moody’s Analytics. The state’s budgeting process and discipline has left Minnesota “really at the cutting edge of not just Midwestern states but also nationwide.”

Minnesota Management and Budget Commissioner Myron Frans, whose agency prepared the recent budget report, highlighted Minnesota’s enviable fiscal position last week, saying, “There are a lot of states that would be really happy to have this kind of forecast.”

More recently, 24/7 Wall Street, a financial news site, and Pew Charitable Trusts, a research nonprofit, said Minnesota is among the best-run states and a leader in putting away money for an economic downturn, respectively.

Minnesota’s comparatively rosy financial outlook comes as new uncertainty is emerging locally and around the world that is likely to test state leaders’ budget prowess.

Minnesota job growth has slowed in the last six months, but the unemployment rate has nonetheless remained below 4 percent for the past year. The state is nearly at full employment, but the labor market has been hampered by persistent mismatches between job seekers’ skills and job requirements. Economists credit Minnesota’s diverse economy for an overall positive forecast, but cautioned that pressures in the national and global economy could reverberate in the state. Low-cost foreign steel is already causing a dramatic slowdown of mining on the Iron Range and putting a drag on the state economy.

“Minnesota’s been this island of prosperity for some time,” said Mark Vitner, a senior economist for Wells Fargo Economics. “It’s somewhat surprising that given the drop in agricultural prices, the pullback in mining activity and slowdown in manufacturing that it really hasn’t had much impact on the state budget.”

External squeeze factors

State budgets in the Midwest are expected to be squeezed by factors largely beyond the control of state officials. A major slowdown in China’s economy is affecting trade, reducing demand for American exports. A strong dollar has further hurt agricultural exports — a major driver of the region’s economy — because it grows corn, wheat and other commodities that are more expensive for other countries. Those outside pressures have state officials across the Midwest worried about just how the declines will affect their states’ bottoms lines.

Federal agricultural officials predicted earlier in December that corn exports will sink to their lowest level in three years, while wheat exports are projected to fall to a 44-year low this season.

The impact on Minnesota’s state budget will be closely watched. Already, state economists reported last week that Minnesota exports are down 6 percent in the first nine months of this year compared with 2014.

Two of Minnesota’s largest trade partners — Canada and China — are seeing their economies shrink, reducing demand for American exports. Canada, for instance, is reeling from the plunge in oil prices, which fell this week to below $40 a barrel. Analysts don’t expect a pickup in prices until late 2016. Previously, they expected prices to recover by the end of this year.

Exports to China and Canada totaled nearly $8 billion last year, nearly 40 percent of the state’s exports that year. Shipments of Minnesota goods make up nearly 7 percent of the state’s gross domestic product, or value of goods and services.

Despite those pressures, economists said Minnesota’s diverse economy — and fiscal policies — will help it weather another slump.

White, of Moody’s, said that Minnesota’s economic outlook is below average, but that the state budget is in better shape than others, highlighting its large rainy-day fund and relatively low pension liabilities.

“If you have poor fiscal policy and a fast-growing economy, you can grow your way out of a lot of problems,” White said. “But if you have an average-growing economy and a better-than-average fiscal picture, then at least some of that has to be because there are some good processes and policy decisions in place.”

The Great Recession battered state budgets across the country and prompted several different reactions from state leaders.

Some states, like Wisconsin, approved tax cuts to stimulate the economy and restore beleaguered budgets.

After years of back-to-back budget deficits, Minnesota took a different approach in 2013 by raising income taxes for the state’s highest earners. As the economy improved, the state replenished budget reserves and saw steady surpluses.

Wisconsin has a budget balance of about $136 million — representing a few days’ worth of state spending, according to Jon Peacock, director of the Wisconsin Budget Project, a nonprofit group.

“As a budget analyst in Wisconsin, I’m envious of Minnesota for a number of reasons,” Peacock said. “That’s partly because Minnesota’s economy has been stronger than Wisconsin’s, but it’s also because Minnesota policymakers do a far better job of planning ahead.”

Long-term fiscal risks

Minnesota’s budget also faces at least one major long-term risk to its fiscal picture: the rapid growth in Medicaid spending, which is steadily eating up a larger share of state spending.

A recent report by the National Association of Budget Officers showed that Medicaid spending by states rose to its highest rate in more than two decades in fiscal year 2015. Part of that has been driven by the expansion of the program in the states following the rollout of the new health care law.

“It’s a big issue that state spending on Medicaid is growing,” said Rep. Matt Dean, R-Dellwood, chairman of the House Health and Human Services Committee. “It is eating the rest of our budget, so that the money we are currently spending within that area is really depleting other areas.”

Last spring, the state reported that Medicaid rolls soared past the 1 million mark for the first time. Total Medicaid spending in Minnesota was projected to grow to nearly $11 billion in 2015, with the state paying about $4 billion of that, up 9 percent from two years ago.

State Rep. Greg Davids, R-Preston, chairman of the Taxes Committee, said the state could make its tax code more competitive with other Midwestern states.

Davids and other legislative leaders are preparing a major tax bill for the upcoming legislative session, promising tax cuts for businesses and individuals.

Gov. Mark Dayton has said he would agree to tax cuts, but warned they shouldn’t be so dramatic that they could potentially lead to deficits.

“That’s why it’s a very delicate balancing act to make sure that what you do doesn’t hurt tax collections but actually enhances them,” Davids said.