Signage is seen at an Exxon gas station in Brooklyn, New York City, U.S., November 23, 2021.
Signage is seen at an Exxon gas station in Brooklyn, New York City, U.S., November 23, 2021. Reuters / ANDREW KELLY

Exxon Mobil Corp on Friday posted its biggest quarterly profit ever on the back of soaring energy prices and as it kept a tight rein on spending.

The top U.S. oil producer reported second-quarter net income of $17.9 billion, or $4.21 per share, an almost four-fold increase over the $4.69 billion, or $1.10 per share, it earned in the same period last year.

Oil and natural gas prices have scaled multi-year highs this year as Western sanctions against major exporter Russia squeezed an already under-supplied global market. Margins for making fuels like gasoline and diesel surged worldwide, boosting the profits of oil giants, including European majors Shell and TotalEnergies , both of which reported results on Thursday.

Exxon's results also beat its best quarter of 2008, when Brent crude oil prices peaked at $147 per barrel, and its best-ever quarter reached in 2012, when the company earned $15.9 billion, largely due to asset sales in Japan and tax-related items.

Exxon's first-quarter profits led U.S. President Joe Biden last month to say the company and other oil majors were capitalizing on a global supply shortage to fatten profits. Exxon, he said, was making "more money than God" after posting its biggest quarterly profit in seven years.

Exxon has been using extra cash to pay down debt and raise distributions to shareholders. It maintained its 88-cent-per-share dividend for the third quarter.

The company earlier this year more than doubled its projected buyback program to $30 billion through 2022 and 2023. Shell and Total on Thursday extended their share buybacks after their second-quarter results both beat what had been a record-breaking previous quarter.

Exxon kept its capital investments at $9.5 billion in the first half of the year, in line with full-year guidance. The profit included a $300 million booked identified item associated with the sale of the Barnett Shale upstream asset.