Marathon Petroleum Corp (MPC.N), opens new tab beat Wall Street estimates for second-quarter profit on Tuesday, benefiting from a rebound in refining margins as fuel demand remained firm.

U.S. refiners are posting upbeat quarterly profits, recovering from the losses in the previous quarter on stronger diesel margins.

Marathon's rivals Valero Energy (VLO.N), opens new tab, Phillips 66 (PSX.N) , opens new tab and HF Sinclair (DINO.N) , opens new tab all exceeded Wall Street estimates.

Diesel cracks - a measure of margins - averaged $17 per barrel during the quarter, in line with the first quarter. However, they ended the three-month period higher at $21 per barrel, TPH & Co analyst Matthew Blair said in a note earlier.

Fuel makers also saw an unexpected boost in profits from higher demand for key products in recent months, easing the slump since 2022 highs, driven by a post-pandemic recovery and war-related supply disruptions.

The margins also benefited from improved capture rates, which reflect a refining company's ability to capitalize on favorable market conditions.

Marathon's throughput volumes for the quarter were 3.1 million barrels per day (mmbpd), unchanged from last year, but now expects 2.9 mmbpd in the third quarter.

Its refining and marketing margin per barrel rose to $17.58 in the quarter from $17.53 a year earlier.

The company reported adjusted profit of $3.96 per share for the three months ended June 30, compared with analysts' average estimate of $3.29 per share, according to data compiled by LSEG.