For years, as oil and gas companies increased production, they hired lots of workers, enriching communities across the United States. That is no longer true.

The country is pumping more oil than ever and near-record amounts of gas. But the companies that extract, transport and process these fossil fuels employ roughly 25% fewer workers than they did a decade earlier when they were churning out less fuel, according to a New York Times analysis of federal data.

Now, with some worried about a looming oversupply of oil, producers are tightening their belt, with spending across North America expected to fall 3% this year, according to Barclays. That raises the specter of further job losses, even as President- elect Donald Trump urges companies to “drill, baby, drill.”

The thinning of U.S. oil and gas jobs is reminiscent of the long decline of the U.S. coal industry, where employment crested decades before production fell as mining companies extracted more rocks with fewer people.

Two decades into the shale boom, companies are drilling wells that extend deeper into the earth, unlocking more oil and natural gas. New technology is letting them oversee drilling, fracking and production from afar, with fewer people on-site. And larger companies are snapping up smaller players, shedding accountants, engineers and other workers as they go.

While the number of jobs has increased from the bleakest days of the pandemic, far fewer people are working in the industry than they were before COVID-19.

Among the cost-cutting techniques being pursued by Exxon Mobil and Chevron: hiring engineers and geologists in India, where labor is cheaper, to support activities in the United States and elsewhere.

The decline in oil and gas work also reflects the continuing transition to cleaner forms of energy, even if that shift is happening more slowly than many analysts had anticipated a few years ago.

“You won’t see a lot of job growth in just the basic act of producing oil and natural gas,” Chris Wright, CEO of the oil field services company Liberty Energy, said in an interview before Trump tapped him to lead the Energy Department.

The industry, Wright said, is “on a trend now of flat to maybe gradually declining employment.”

During the first half of the U.S. fracking boom, oil and gas companies added workers at a much faster clip than other industries did. The industry nearly doubled in size over 10 years, turbocharging the economies of such places as North Dakota.

Then, in 2014, oil prices crashed. It took a couple of years, but U.S. production eventually bounced back, soaring to a record of nearly 13.5 million barrels a day last fall. Employment never fully recovered, though, entering an undulating decline punctuated by booms and busts, most recently during the pandemic, when oil prices briefly plunged below zero.

That the oil and gas industry has become more productive is good news for the economy, which benefits when people are able to do more with less, said Jesse Thompson, an economist with the Federal Reserve Bank of Dallas.

“But in the meantime,” he said, “there are firms and individuals and communities that can lose out.”