Exxon Mobil Corp reported a better-than-expected second-quarter profit on Thursday, as oil prices and margins to process crude into fuel rebounded from a year earlier and production rose.

Conditions in the refining sector have improved in recent months, with business and consumer demand for diesel and gasoline rebounding.

Crude oil prices have also climbed about 30 percent from a year ago, another factor that has contributed to higher profits in the second quarter for oil companies.

Production was really strong although it was more oriented to gas than oil, said Phil Weiss, oil analyst with Argus Research. And like the other big oil companies, the refining results were also very strong.

Profit in the quarter excluding items, was $7.56 billion, or $1.60 per share, compared with $4.09 billion, or 85 cents a year ago.

Analysts on average had expected a profit of $1.46 per share, according to Thomson Reuters I/B/E/S.

Oil and gas output in the quarter rose 8 percent, boosted by the company's liquefied natural gas projects in Qatar, Exxon said.

Exxon's refining business reported a better-than-expected profit of $1.22 billion in the second quarter, up sharply from $512 million from a year earlier.

Barclays Capital had expected Exxon's refining business to report a profit of $860 million.

Shares of Exxon rose to $61.35 in premarket trading from Wednesday's close of $60.91.

(Reporting by Anna Driver in Houston, editing by Dave Zimmerman)