Exxon Mobil Corp. on July 29 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 multiyear 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 Plc and TotalEnergies SE, both of which reported results on July 28.

Exxon Mobil’s results also beat its best quarter of 2008, when Brent crude oil prices peaked at $147/bbl, 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 Mobil’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 Mobil, he said, was making “more money than God” after posting its biggest quarterly profit in seven years. 

Exxon Mobil 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 July 28 extended their share buybacks after their second-quarter results both beat what had been a record-breaking previous quarter.

Exxon Mobil 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.