Exxon Mobil returned to a profit in its fourth quarter as demand for oil continues to improve.

The oil and natural gas company earned $8.87 billion, or $2.08 per share for the final three months of 2021. A year earlier it lost $20.07 billion, or $4.70 per share.

Removing certain items, earnings were $2.05 per share. Analysts polled by Zacks Investment Research expected a profit of $1.96 per share, on average.

Exxon does not adjust its reported results based on one-time events such as asset sales.

Exxon is capitalizing on a resurgence in oil demand following a slowdown during the pandemic. Crude is up 17% so far this year, and Exxon is up 24%.

“Our effective pandemic response, focused investments during the down-cycle, and structural cost savings positioned us to realize the full benefits of the market recovery in 2021,” Chairman and CEO Darren Woods said in a statement on Tuesday.

Fourth-quarter oil-equivalent production was 3.8 million barrels per day. Excluding entitlement effects, divestments, and government mandates, oil-equivalent production increased 2% compared with the year-ago period.

Quarterly revenue surged to $84.97 billion from $46.54 billion. Wall Street was calling for revenue of $82.44 billion.

The financial report comes a day after Exxon said that it is restructuring its business into three divisions and moving its headquarters 250 miles south from Irving, Texas, to its campus north of Houston.

Shares of Exxon rose slightly before the market open.