(Correct second paragraph to read first nine months, not first three)
* EPS $1.79 v Street view $1.77
* Output up 1.5 percent, first gain since 2011 2nd qtr
* Shares edge up
By Anna Driver
Oct 31 (Reuters) - Exxon Mobil Corp, the world's largest publicly traded oil company, reported higher-than-expected quarterly results on Thursday as output rose for the first time in more than two years, but refining weakness hurt earnings.
Exxon and other large oil companies struggling to boost production in recent years have spent heavily on new projects. In the first nine months of this year, Exxon alone spent $33 billion.
"This is their first year-over-year (production) increase in more than two years," said Brian Youngberg, an energy company analyst at Edward Jones in St. Louis. "It does show that they are hopefully making some progress stemming the decline that they've shown the last couple of years."
Exxon last reported a quarterly gain in production in the second quarter of 2011.
Oil and natural gas output rose 1.5 percent from a year earlier to 4 million barrels oil equivalent per day, helped by the start-up of new projects, the Irving, Texas, company said.
Natural gas from Australia's Kipper Tuna Turrum project and accelerated output from projects in Nigeria and Canada also contributed to the higher production.
Profit in the third quarter was $7.87 billion, or $1.79 per share, compared with $9.57 billion, or $2.09 per share, a year earlier.
Analysts on average had expected $1.77 per share, according to Thomson Reuters I/B/E/S.
"Weaker margins, mainly in refining, decreased earnings by $2.4 billion," Exxon said in a statement.
Oil companies with refining units, such as Exxon and Royal Dutch Shell, have seen profit hurt in the quarter as demand for fuels like gasoline and diesel waned and global refining capacity grew.
Exxon's refining unit had a profit of $592 million in the latest quarter, down sharply from $3.2 billion a year earlier.
The company's shares rose in premarket trading to $89, up slightly from Wednesday's New York Stock Exchange close of $88.81.
(Reporting by Anna Driver; Editing by Gerald E. McCormick and John Wallace)