Exxon Mobil Corp. said its profit for the second quarter rose 28%, despite pumping oil and gas at its lowest rate in almost five years.

America's biggest energy company by revenue was buoyed by higher oil prices in the U.S. and globally, lifting its earnings to $8.78 billion on revenue of $111.65 billion. It also got a boost from higher profits for refining crude and manufacturing chemicals. But its oil and gas production sank 5.7%...