U.S. machinery maker Caterpillar Inc posted stronger-than-expected quarterly earnings on Tuesday and raised its full-year outlook, citing what it said were growing signs of stability in the world's credit markets and economies.

The company, the world's largest maker of construction and mining equipment and a closely watched component of the Dow Jones industrial average, said fiscal stimulus programs, especially in China, were beginning to pay off and commodity prices were holding in a range that was positive for investment.

The upbeat outlook, which Caterpillar's chief executive said set the foundation for an eventual recovery, sent the company's shares surging as much as 13 percent in early trading on the New York Stock Exchange.

There is still a great deal of economic uncertainty in the world, Chairman and Chief Executive Jim Owens said in a statement. But we are seeing signs of stabilization ... Credit markets have improved significantly. Fiscal policy and monetary stimulus have been introduced around the world, and we are seeing signs, particularly in China, that they are beginning to work.

Caterpillar reported a second-quarter net profit of $371 million, or 60 cents a share, compared with $1.11 billion, or $1.74 a share, last year.

Sales and revenue fell 41 percent to $7.98 billion.

Stripping out costs associated with layoffs and restructuring, Caterpillar made 72 cents a share. Since the end of 2008, Caterpillar has cut 17,100 full-time workers.

Analysts, on average, had expected the Peoria, Illinois-based company to report a profit of 22 cents a share on sales of $8.36 billion, according to Reuters Estimates.

The better-than-expected results sent Caterpillar's shares up $4.28, or 11.7 percent, to $40.93 after earlier touching $41.45.

Caterpillar raised its outlook for full-year profit, including redundancy costs, in a range of 40 cents to $1.50 with a midpoint of 95 cents a share. When it reported first-quarter results three months ago, Caterpillar put that midpoint estimate at just 50 cents a share.

Ann Duignan, an analyst at JP Morgan, said last quarter's better-than-expected results were driven by two factors: higher margins in the company's engine business and a lower-than- expected tax rate of just 10 percent.

The performance of the company's machinery business, which makes tractors, excavators and other equipment and is more suggestive of what rivals like Deere & Co , CNH Global NV , Terex Corp and Komatsu Ltd <6301.T> may report later this earnings season, were far less encouraging.

The unit reported an operating loss of $252 million, down from an operating profit of $719 million a year ago, hurt by sharply lower sales in Europe, the Middle East and Africa as well as North America.

The company's engines unit, by contrast, reported an operating profit of $555 million, down from $711 million last year.

You have huge profitability in engines right now, said Eli Lustgarten, an analyst at Longbow Research. The question is how sustainable is that? That's what saving the company right now.

(Reporting by James Kelleher; Editing by Maureen Bavdek)