HOUSTON (Reuters) - Weak refining margins hurt Exxon Mobil Corp XOM.N and Chevron Corp's CVX.N first-quarter profit, cutting into overall gains from rising oil prices.

FILE PHOTO: A Chevron gas station sign is shown in Cardiff, California, January 25, 2016. REUTERS/Mike Blake/File Photo

It was the second consecutive quarter that refining weakness, especially outside the United States, clipped improved profit.

Strength in the Chevron division that pumps oil and gas helped overcome the refining weakness and beat Wall Street profit expectations for the quarter.

Exxon, though, has struggled in recent quarters to boost oil and gas output, and its overall first-quarterly results badly lagged expectations.

Shares of Exxon fell 3.7 percent to $77.88 in afternoon trading while Chevron rose 1.9 percent to $126.64. Exxon is off about 6.6 percent in the last two years while Chevron has soared 24.5 percent.

“While the fourth quarter was a disaster for both, Chevron got back on track” in the first quarter, said Brian Youngberg, an oil industry analyst at Edward Jones. “Exxon’s still trying to get back on the road.”

Both Exxon and Chevron have consistently touted the benefits of owning businesses that produce and refine oil, saying they better balance earnings as commodity prices rise and fall.

U.S. oil prices CLc1 fell slightly to $67.98 per barrel. [O/R]

Rising oil prices typically harm refiners by squeezing their margins on products, but they also boost profit at divisions that produce crude.

The strategy worked for Chevron during the quarter, helping the company top Wall Street expectations. At Exxon, weak refining results were coupled with lower oil production, fueling concern about Chief Executive Officer Darren Woods’ turnaround plan for the world’s largest publicly traded oil producer.

Refining margins in Europe BRT-ROT-REF, for instance, fell more than 14 percent in the quarter and were on track for a 38 percent drop in the second period, the biggest quarterly decline since the fourth quarter of 2015.

Profit fell 12 percent in Exxon’s downstream refining unit, and 14 percent in its chemical unit.

At Chevron, earnings in refining and chemical operations dropped 21 percent to $728 million.

Both companies have sought to bolster refining operations. Reuters reported earlier this month that they have asked U.S. regulators for exemptions to U.S. biofuels rules that are typically only given to small companies in financial distress.

‘NOT WHAT THE MARKET WANTS’

Both companies said they are accelerating shale drilling in the Permian Basin of west Texas and New Mexico, the largest U.S. oilfield, helping to lift the nation’s output so far this year to more than 10 million barrels per day, a new record.

(To view a graphic on Exxon's quarterly results, click here: reut.rs/2Kg4peq)

Exxon’s U.S. production swung to a $429 million profit from a year-earlier loss. But Exxon has continued to invest heavily in projects that will not produce oil or gas for years. In contrast, Chevron is benefiting from past investments that have boosted output, especially in liquefied natural gas.

Exxon also has struggled in the past 16 months to unwind some of the biggest bets taken by former CEO Rex Tillerson, who left to become U.S. secretary of state in early 2017 before being fired by President Donald Trump last month.

"The Exxon strategy right now is not what the market wants," said Mark Stoeckle, portfolio manager of Adams Natural Resources Fund PEO.N, which holds Exxon shares.

“The market wants the cash back. They want what Exxon can’t give them today because of the mismatch between investment and production.”

Exxon and Chevron told investors on Friday that it was too soon to begin buying back shares, something Wall Street has pushed for.