Oil giants Exxon Mobil Corp and Royal Dutch Shell Plc said their profits jumped more than 40 percent in the third quarter as higher energy prices offset declines in their output.

Oil prices have sagged from their May peaks, but still remain well above the 2010 levels. Recent optimism that the global economy may be recovering has sent crude prices climbing 20 percent this month.

Still, the world's two biggest publicly traded oil companies have struggled to stem a drop in their output, and record spending by Exxon of $26.7 billion for the first nine months of 2011 has not yet turned that trend around.

Exxon's oil and gas output fell 4 percent to 4.28 million barrels of oil equivalent per day, lagging Wall Street expectations. Shell's output slid 2 percent.

Production was quite a bit lower than we were modeling, Raymond James analyst Pavel Molchanov said Thursday of Exxon's output. It's a recurring theme we've seen from peer companies.

The dip in crude oil prices during the third quarter helped both Exxon and Shell lift their profit margins at their refineries and chemicals businesses, particularly in the United States.

Shell posted a 25 percent profit increase over year-ago levels at its refineries and chemicals businesses, and Exxon saw its refineries' profits climb 36 percent.

Those gains, however, lagged the nearly 54 percent increase Exxon posted from its oil and gas producing arm and the 58 percent jump in Shell's earnings from that segment.

Exxon has projects in the works that promise growth. On a conference call with analysts, the company said drilling has shown that its big Hadrian prospect in the Gulf of Mexico is exceeding expectations. The company is also adding wells in the oil-rich Bakken shale in North Dakota.

RISING TIDE

Shell, Europe's largest oil company by market capitalization, said its underlying current cost of supply (CCS) net income, which excludes one-offs and non-cash accounting charges, soared 42 percent in the third quarter to $7.0 billion, while Exxon, the world's largest publicly traded oil company, reported a 41 percent increase to $10.3 billion.

Occidental Petroleum Corp , the fourth-largest U.S. oil company said its third-quarter profit rose 49 percent while daily oil and gas production soared to a record.

Italy's Eni's production fell 13.6 percent due to the conflict in Libya, while underlying, or adjusted net profit, in dollar terms rose 19 percent.

Norway's Statoil said its adjusted net income rose 50 percent to $2.07 billion in the third quarter and its production climbed 14 percent. Still, the company cautioned that its output would fall slightly this year.

Shell's London-listed A shares traded up 1.5 percent at 2,287 pence at 1142 GMT, compared with a 12.15 percent rise in the STOXX Europe 600 Oil and Gas index <.SXEP>. Statoil shares rose 2.26 percent to 144.9 Norwegian crowns.

Exxon shares were up 0.3 percent at $81.34, while shares of Occidental Petroleum soared 9 percent to $95.13. Exxon's shares were underperforming a nearly 4 percent gain in the CBOE index of oil companies <.OIX>. (Reporting by Tom Bergin in London, Anna Driver in Houston and Matt Daily in New York, editing by David Cowell, Dave Zimmerman and Gunna Dickson)