Oil giant ExxonMobil Corp. (XOM) on Thursday posted the largest annual profit by a U.S. company — $39.5 billion — even as earnings for the last quarter of 2006 declined 4 percent.

The 2006 profit topped the previous record of $36.13 billion which Exxon set in 2005.

Revenue at the world's largest publicly traded oil company rose to $377.64 billion for the year, surpassing the record $370.68 billion that Exxon posted in 2005.

ExxonMobil's record annual earnings followed a year of extraordinarily high energy prices as crude oil topped $78 a barrel in the summer — driving up average gasoline prices in the United States to more than $3 a gallon. Prices retreated later in the year.

The fourth-quarter decline reflects lower profits from Exxon's refining and marketing segment and a sharp dropoff in natural gas prices.

Profit for the fourth quarter of 2006 declined to $10.25 billion from $10.71 billion Exxon earned in the 2005 quarter — a record quarterly profit for any U.S. public company.

Per-share earnings rose to $1.76 from $1.71 as the company reduced the number of shares outstanding.

For the year, Exxon earned $6.62 per share in 2006 versus $5.71 per share in 2005.

Click here to visit FOXBusiness.com's Energy Center.