The upbeat results following a contested board fight over the company's direction highlighted how oil producers are taking advantage of a recovery in oil prices to cut debt and boost shareholder payouts rather than spend more to raise production.

"Positive momentum continued during the second quarter across all of our businesses as the global economic recovery increased demand for our products," Chief Executive Darren Woods said.

Exxon said its 2021 capital spending is expected to be at the lower end of the prior range of $16 billion to $19 billion.

Earlier in the day, rival Chevron cut its 2021 budget, although both U.S. producers expect higher spending in the second half of the year as they resume investments on key projects, including the prolific Permian basin.

"ExxonMobil continued the parade of major oils companies with rapidly improving results, recovering from the depths of the COVID crisis during the second quarter last year," Third Bridge Group's Peter McNally said.

Exxon again used higher cash flow to pare a massive debt built up to preserve its shareholder dividend amid historic losses. The company cut debt by $2.7 billion, bringing total reductions to about $7 billion since the end of 2020.

While Exxon backed shareholder returns through dividend, Chevron said it would resume share buybacks at an annual rate of between $2 billion and $3 billion.

Exxon also said it was on pace to achieve cost savings of $6 billion through 2023 relative to 2019. In the first half of 2021, it cut over $1 billion in costs, on top of reductions of $3 billion last year.

Exxon earned $1.10 per share in the second quarter, beating market expectations of 99 cents, according to Refinitiv IBES data. Late last month, the company had given a broad indication about its results, prompting several analysts to reduce their earning projections.

Shareholders had cast out three Exxon directors in May for a hedge fund's nominees, promising to boost returns and better prepare the company for a low-carbon world.

CEO Woods said the company started working with the new directors in June with in-depth reviews of its businesses and the first in-person regular meeting of the board took place this week following virtual sessions.

Earnings from its chemicals and plastics business rose nearly fivefold from a year ago to a record $2.32 billion as margins expanded on strong demand for plastic packaging, tight industry supply and shipping constraints.

Higher oil prices pushed earnings in the company's exploration and production business to $3.19 billion. Output fell 2% to 3.6 million oil-equivalent barrels per day during the quarter.

The company said it expects higher oil and gas volumes in the current quarter due to reduced planned maintenance.

However, refining and marketing business is yet to recover and posted a loss of $227 million, hurt mainly by maintenance costs and product oversupply.

Exxon's U.S. refining business has lost money for six quarters in a row. Outside the United States, refining operations have run in the red in five of the last six quarter.

Shares of the company, which have risen 43% this year after plunging during the height of the pandemic, were down 2.3% at $57.59, amid a broader drop in energy stocks.

Net income for the second quarter came in at $4.69 billion, compared with a loss of $1.08 billion a year ago, which included a gain related to reversing an inventory writedown.

(Reporting by Arathy S Nair in Bengaluru, Sabrina Valle in Houston and Liz Hampton in Denver; Editing by Saumyadeb Chakrabarty and Arun Koyyur)

By Arathy S Nair and Sabrina Valle