Big oil companies are generating their biggest cash flows in years and heeding investor calls to return it to shareholders instead of using it to drill.

The two largest U.S. oil companies, Exxon Mobil Corp. and Chevron Corp., reported on Friday their most profitable quarterly earnings since before the onset of the global pandemic. Exxon reported earnings of $6.8 billion, its best quarterly performance since 2017, and said it would launch a $10 billion share buyback program starting next year. Chevron reported $6 billion in...

Big oil companies are generating their biggest cash flows in years and heeding investor calls to return it to shareholders instead of using it to drill.

The two largest U.S. oil companies, Exxon Mobil Corp. and Chevron Corp. , reported on Friday their most profitable quarterly earnings since before the onset of the global pandemic. Exxon reported earnings of $6.8 billion, its best quarterly performance since 2017, and said it would launch a $10 billion share buyback program starting next year. Chevron reported $6 billion in net income, its best quarter since 2013, and said it generated $6.7 billion in free cash flow, its most ever.

The industry is reaping the rewards of resurgent commodity prices—U.S. crude prices have topped $80 a barrel this month for the first time since 2014—as the economy emerges from Covid-19 driven stagnation. Global energy demand is rebounding faster than anticipated, and global oil production, while still rising, is struggling to catch up with the surge in consumption.

Investors and analysts are watching closely to see if the oil industry will succumb to the temptation of plowing more money into growing production amid higher oil prices and increased demand, shrugging off austerity measures implemented during the pandemic.

Exxon reported quarterly earnings of $6.8 billion Friday.

Photo: David Paul Morris/Bloomberg News

After years of dismal returns, investors have sought pledges from producers that they will moderate growth and focus on shareholder payouts. Some investors want companies to diversify and pivot to renewable energy as many countries transition to cleaner energy sources amid concerns about climate change.

So far, most companies are sticking to smaller budgets and pledging to return more cash to shareholders.

Exxon raised its quarterly dividend on Wednesday by 1 cent, its first such increase since 2019, and said Friday it generated $12 billion in cash from operations. Chevron said Friday that its year-to-date capital spending is down 22% and it paid dividends of $2.6 billion, reduced debt by $5.6 billion, and repurchased $625 million of shares during the quarter.

“Free cash flow more than covered the dividend and $4 billion of additional debt reduction,” Exxon CEO Darren Woods. “With the progress made in restoring the strength of our balance sheet, this week we announced a dividend increase maintaining 39 consecutive years of annual dividend growth.”

SHARE YOUR THOUGHTS

How long do you think oil prices will continue to climb? Join the conversation below.

European energy companies are also raking in cash but say they will continue to use more of it to fund renewable-energy projects and investor payouts than growing oil and gas production.

TotalEnergies SE reported $4.6 billion in profit Thursday and said that strong cash generation from fossil fuels is enabling it to invest in growing its renewable-energy and electricity businesses. Royal Dutch Shell PLC, which is facing calls by activist investor Third Point LLC to split into two companies, reported a loss of $447 million Thursday, after writing off $5.2 billion linked to commodity derivatives. But the Anglo-Dutch giant said it produced $16 billion in free cash flow, its most ever, and would distribute $7 billion to shareholders from the $9.5 billion sale of its shale assets in the Permian basin to ConocoPhillips in September. BP PLC reports earnings next week.

Though oil prices are up around 60% on the year, 50 of the largest oil companies have only increased their annual budgets by 1%, according to Raymond James. The companies initially budgeted $271 billion and that has only ticked up to $275 billion, the financial firm said in a note to investors.

Mark Stoeckle, chief executive of Adams Funds, said that in past oil-price surges Western oil companies have ramped up drilling, outspending their cash flows in pursuit of higher valuations to the detriment of returns. But even before the pandemic, investors began fleeing the sector and conveying to oil executives and boards that the only way to entice them back was to moderate growth and offer fat payouts, according to Mr. Stoeckle. The current price cycle is the first test of that capital discipline, he said.

While most producers appear to be abiding by investors’ wishes for now, questions linger for some about how they will spend their money beyond that. Unlike their European peers, U.S. oil companies are largely not diversifying into renewable energy.

Chevron CEO Mike Wirth has repeatedly said that Chevron won’t invest in wind or solar power generation because he doesn’t think it can make a larger return in those businesses. Instead, Chevron will return cash to investors and “let them plant trees” if they choose to, he said in a television interview in September.

Both Chevron and Exxon created low-carbon business units this year that will primarily focus on biofuels, hydrogen production, carbon capture and other technologies. Chevron tripled its planned investment in its unit in September, saying it would spend $10 billion through 2028. Exxon increased its low-carbon spending Friday, saying it would invest $15 billion on such projects from 2022 through 2027.

But the increased green investment still represents a fraction of what the companies are spending on oil and gas projects, and it is unclear how profitable the units will be for the foreseeable future. Many of the technologies they are investing in will need further government subsidies to be economic.

Not everyone thinks tighter budgets are a good thing. During a contentious Congressional hearing Thursday, some Republican lawmakers urged Mssrs. Wirth and Woods and executives from Shell and BP to increase their oil production to alleviate high prices. Democrats on the House Committee on Oversight and Reform convened the hearing after accusing the oil industry of waging a campaign to spread disinformation about fossil fuels’ role in causing global warming.

Exxon has said it would keep production roughly flat. On Friday, it said quarterly production increased 4% from the same period last year.

Chevron is increasing production, modestly. Pierre Breber, its chief financial officer, said in an interview that the company’s production was up 7% in the quarter compared with the same period last year and will increase 3% annually through 2025. But he said Chevron is unlikely to commission any mega-oil projects that take years to come online and years more to pay out. Instead it is planning to drill more shale wells in the U.S., which produce quickly but decline rapidly.

“This is a sector that is working hard to attract investors,” Mr. Breber said. “We really believe the winning combination for investors is the traditional business that’s high return, low growth, low carbon combined with faster growing new energy businesses.”

Write to Christopher M. Matthews at christopher.matthews@wsj.com