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 percent 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 percent this year, according to Barclays. That raises the specter of further job losses, even as President Trump urges companies to “drill, baby, drill.” The thinning out of American 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 total number of jobs has increased from the bleakest days of the pandemic, far fewer people are working in the industry than before Covid. 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, chief executive of the oil field services company Liberty Energy, said in an interview before Mr. Trump tapped him to lead the Energy Department. The industry, Mr. Wright said, is “on a trend now of flat to maybe gradually declining employment.” Mr. Trump will “protect our energy jobs” while lowering costs for consumers, said Karoline Leavitt, a spokeswoman. During the first half of the American fracking boom, oil and gas companies added workers at a much faster clip than other industries. The industry nearly doubled in size over 10 years, turbocharging the economies of places like North Dakota, home to the Bakken shale formation. 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. Matthew Waguespack was fracking a well in early 2020 when a representative for the oil company that had hired his team to do fieldwork walked into the crew’s mobile office in eastern New Mexico. “Pump all your sand, pump all your chemicals, pack up,” Mr. Waguespack recalled the man telling the team. “And get out of here.”