Stocks rose on Tuesday amid signs the global economy was recovering and optimism that corporate earnings reports will beat expectations.

Australia became the first G20 country to raise interest rates since the onset of the financial crisis, saying that the worst danger for the economy had passed, which underscored for many that the global economy was on the mend.

The economic optimism spurred gains in energy and other commodities, lifting shares of oil and resource companies. Shares of Exxon Mobil Corp rose 1.6 percent to $68.66 and were among the top gainers on the Dow.

The hike in a key lending rate by the Australian central bank is a confirmation that things are picking up in my opinion, said Kevin Kruszenski, head of listed trading at KeyBanc Capital Markets in Cleveland. It's a good barometer as to what is going on in that part of the world.

Expectations of a rebound in revenue and earnings for the recently ended third quarter fed the optimism. Quarterly earnings are due to kick off late Wednesday, with results from aluminum company Alcoa Inc . Its shares were up 3.5 percent to $13.89. For a graphic on earnings, see http://graphics.thomsonreuters.com/109/US_EARNGS1009.gif

The Dow Jones industrial average <.DJI> was up 131.50 points, or 1.37 percent, at 9,731.25. The Standard & Poor's 500 Index <.SPX> was up 14.26 points, or 1.37 percent, at 1,054.72. The Nasdaq Composite Index <.IXIC> was up 35.42 points, or 1.71 percent, at 2,103.57.

It was the market's second day of gains, after marking its second week of losses on Friday. The S&P 500 is now up about 56 percent since hitting 12-year lows in early March.

I think expectations going into the quarter are for a fairly positive earnings season. Last quarter about 70 percent of companies beat estimates on the heels of aggressive cost cutting and very weak consensus estimates, said Michael Sheldon, chief market strategist at RDM Financial in Westport, Connecticut.

Since the economy has shown some signs of improvement since then, it's reasonable to think corporate results will do better, he said.

Third-quarter earnings for S&P 500 companies are still expected to have declined 24.8 percent from a year ago, according to data from Thomson Reuters.

After the close, shares of Yum Brands Inc , the parent of Taco Bell and other fast-food chains, rose 3.9 percent to $36.20 after it reported a profit that beat expectations and raised its full-year earnings forecast.

Benchmark U.S. gold futures scaled an all-time high at $1,045 an ounce on Tuesday, adding to gains in commodity-related shares. Freeport-McMoRan Copper & Gold Inc advanced 3.4 percent at $69.61.

Shares of industrial companies sensitive to the economy's cycles also rose. Shares of United Technologies Corp , the world's largest maker of elevators and air conditioners, climbed 1.8 percent at $61.49.

On Nasdaq, Microsoft Corp increased 1.9 percent to $25.11 after introducing new software for mobile phones to compete with Apple Inc's iPhone. Apple shares rose 2.1 percent at $190.01.

Volume was below average on the New York Stock Exchange, with 1.23 billion shares changing hands, under last year's estimated daily average of 1.49 billion, while on the Nasdaq, about 2.42 billion shares traded, above last year's daily average of 2.28 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of 4 to 1, while advancing stocks beat decliners on the Nasdaq, by about 10 to 3.

(Editing by Leslie Adler)