Moody’s Investors Service has a more positive view of the oil and natural gas industry this year and has raised its outlook for the upstream and oilfield services (OFS) sectors.

The global integrated oil and gas sector outlook was raised to “positive” from “stable” as higher profits from upstream operations fuel a faster recovery in earnings growth.

“We expect earnings growth for the global integrated oil and gas industry of between 13-18% this year, assuming oil prices remain around the midpoint of our forecast oil price range of $40-60/bbl,” said senior credit officer Elena Nadtotchi.

The projected earnings increase follows declines of 12% in 2016 and 40% in 2015 after two years of depressed oil and natural gas prices.

Higher profits from upstream operations “are the main driver behind the accelerated recovery” in the upstream sector’s earnings outlook. After cutting production costs by 20-30% in 2015-2016, “the sector is set to deliver quicker improvement in operating margins in the higher oil price environment.”

Moody’s expects the sector’s capital expenditures likely will plateau at $130-135 billion in 2017-2018, which is similar to the level in 2016. It’s still down by 35% from the top level of more than $200 million in 2013.

Merger and acquisition activity is expected to increase among upstream players “as fundamental conditions in the sector continue to improve,” Moody’s analysts said. “Also, the credit profiles of global integrated oil and gas companies are set to recover in 2017, with all firms registering a turnaround in their leverage metrics at end-2016.”

For the OFS sector, Moody’s has revised its outlook to “stable” from “negative,” with earnings expected to increase by 6-8% following two years of “extreme stress and declining earnings.”

The revised outlook comes as oil prices and upstream spend show signs of recovery, buoyed by expected gains in OFS operating margins from depressed levels and increased drilling budgets, signs of “increasing optimism” for the industry.

“While OFS companies will remain stressed in regions with high production costs and excess service capacity, the broader operating environment will become less dreadful as higher energy prices keep spurring U.S. rig activity and stabilizing international markets,” said Moody’s Vice President Sajjad Alam.

However, Moody’s analysts cautioned that not all OFS segments and markets will stabilize or recover uniformly.

“Oilfield activities are expected to accelerate in U.S. and Canadian markets and stabilize in most onshore international markets, but will continue to decline offshore during 2017.”

Onshore equipment utilization is showing positive signs of recovery, and companies should regain some pricing power “as soon as the second half of 2017 — particularly in the U.S., where equipment oversupply is easing.”

As an example of the uneven recovery, the deepwater and ultra-deepwater markets should continue to see reduced investments and project deferrals “at least through mid-2018.”

Given their scale and amount of assets and offerings, the large and diversified OFS operators may disproportionately capture most of the incremental margins and likely will be able to expand their market share, Moody’s said. For smaller, specialized and regionally focused OFS companies, “tough business conditions will persist in 2017, offering limited operating and financial flexibility.”