Devon Energy Corp. said Tuesday that it would cut its workforce by 20%, slash its quarterly dividend and pare spending this year as depressed energy prices continue to weigh on the oil-and-gas producer.

Shares added 2.3% to $21.75 in after-hours trading.

Oklahoma City-based Devon announced the moves to preserve its balance sheet as it reported a fourth-quarter loss and a 52% drop in revenue. Devon has been working to cut costs as prices for oil and gas prices remain depressed.

The company said it would cut 20% of its workforce in the first quarter, a move that could save the company up to $500 million a year when combined with other cost cuts. The company also expects to reduce its field-level costs by $300 million to $400 million this year.

The company set a capital spending budget for exploration and production of $900 million to $1.1 billion, down 75% from last year's level.

"Devon's top priority in 2016 is to protect the balance sheet," Chief Executive Dave Hager said. "We are tailoring activity to current market conditions and are prepared to adjust capital plans throughout the year."

The company said it plans to use proceeds from divestitures to reduce its debt and announced a 75% cut to its quarterly dividend, which now stands at 6 cents a share.

Mr. Hager cited "the current commodity price environment and the uncertain duration of this downturn" for the dividend cut, which will improve the company's cash flow by $320 million a year.

That comes as Devon reported a fourth-quarter loss of $4.53 billion, or $11.12 a share, compared to a year-earlier loss of $408 million, or $1.01 a share.

Profit was weighed down by a $5.34 billion writedown and $78 million in restructuring charges. Excluding those items, per-share earnings were 77 cents.

Revenue tumbled 52% to $2.89 billion.

Analysts polled by Thomson Reuters expected per-share profit of 70 cents and revenue of $3.63 billion.

Devon has spent years paring down its holdings to focus on North America, and in December agreed to buy a combined 333,000 acres in Oklahoma and Wyoming for $2.5 billion. The company has said it plans to sell some other acreage, as well as pipelines in Canada, for up to $3 billion.

Write to Chelsey Dulaney at chelsey.dulaney@wsj.com