Chevron Corp reported lower quarterly earnings on Friday, missing Wall Street forecasts, as rising spending on oil and gas projects and losses at its U.S. refinery business offset gains from higher crude oil prices.

Its shares were down 2.2 percent at $104.21 by midday, nearly $7 short of the record high they hit early this month.

Oil and gas production at the No. 2 U.S. oil company declined to 2.64 million barrels per day (BPD) from 2.79 million BPD a year-before, while average benchmark oil prices rose about 25 percent over the same period.

The company said the major factors behind the 2011 output shortfall were the effect of higher prices on production sharing contracts, lower-than-expected performance at large new offshore projects in the Gulf of Mexico and Angola, and a third-party pipeline rupture and decreased demand in Thailand.

Chevron had said earlier this month its refinery business would about break even for the quarter, but U.S. losses pulled the entire segment into the red, and the company's profits from oil and gas sales also appeared weaker than expected.

It was a miss on some non-controllable factors, said Pavel Molchanov, analyst with Raymond James in Houston, citing the timings of sales and global pricing differences as the likely reason oil and gas profits fell about $500 million below his forecast.

Still, Chevron added 1.67 billion barrels of oil equivalent to its reserves last year, 171 percent of its 2011 output, which was a very strong performance, Molchanov said.

The company is embroiled in some huge legal battles in South America, including one in Brazil where a prosecutor plans to file criminal charges against it and some of its local managers.

Chevron also faces an $11 billion lawsuit in Brazil related to an offshore spill in November. Chief Executive John Watson said the company's people in Brazil had responded in textbook fashion even if it did not put its best foot forward in its communications.

The San Ramon, California-based company also remains locked in a legal war against plaintiffs in Ecuador, who won an $18 billion judgment against it in a court there.

Watson cited the many defenses Chevron can still pursue, and said an arbitration tribunal on Wednesday strengthened its hand by converting previous interim measures to an interim award obligating Ecuador, under a treaty with the United States, to prevent enforcement worldwide pending a full review of the case.

That makes it have more standing in the international community, Watson said. This award is helpful to us in preventing enforcement outside of Ecuador.

In Nigeria, where a natural gas well just off the coast is burning after an accident this month, Watson said it expected to start a relief well within the next week or so.

PROFIT DIP

Fourth-quarter profit slipped to $5.1 billion, or $2.58 per share, from $5.3 billion, or $2.64 per share, a year earlier. That fell short of the $2.84 per share analysts had expected, according to the average on Thomson Reuters I/B/E/S, which was already 17 cents down in response to Chevron's warning.

Among other U.S. oil companies, the quarterly profits from ConocoPhillips and Occidental Petroleum Corp earlier this week topped Wall Street estimates, though Hess Corp fell short.

Chevron is spending piles of money on production growth that will not kick in until 2014. Its 2012 capital budget of $32.7 billion compares with $29.1 billion in 2011 - $3 billion above than previous 2011 guidance due to increased spending related to its Atlas shale gas acquisition and in response to higher oil prices.

In the fourth quarter, Chevron's spending on U.S. oil and gas projects nearly doubled from a year ago to $2 billion, while outside the U.S. it grew by more than a quarter to $5.1 billion.

Watson said 2013 and 2014 would also be high capital spending years as it completes work on Australian liquefied natural gas projects and new Gulf of Mexico developments.

Its $9 billion Angola LNG project is due to start up later this year, and Watson said the company was working to find new buyers for gas that had originally been intended for the now-glutted North American market.

Partly offsetting that new output would be the first major maintenance work at its plant in Tengiz in Kazakhstan since its startup in 2008, which would last around six weeks in the third quarter of this year.

(Reporting by Matt Daily in New York and Braden Reddall in San Francisco, editing by Dave Zimmerman)