Stocks rose on Tuesday, boosted by swift steps toward formation of a new Italian government and stronger-than-expected reports on the U.S. economy.

Stocks sensitive to economic growth led the rally, with technology and industrials the best performers. Apple rose more than 2.5 percent, up for only the second day in the last eight.

But despite Tuesday's advance and after posting gains in five of the last six weeks, the S&P 500 is flat for the year and trapped in a tight range. The index could find tough technical resistance to continue its rise on Wednesday.

Markets have been jittery as the euro zone's debt crisis is in danger of spiraling out of control. Borrowing costs spiked again in Italy. France, until now not viewed as problematic, also was hit by higher bond yields.

Mario Monti, Italy's prime minister-designate, is expected to complete the process of forming a government in less than three days, much faster than normal, as Italy races to ward off a major financial and political crisis that has pushed its borrowing costs to untenable levels.

This sense of urgency in forming a new government is giving the market relief, said Quincy Krosby, market strategist at Prudential Financial in Newark, New Jersey.

As long as the news out of Europe is less dramatic, that gives the U.S. market a chance to focus on domestic data. she said. And retail numbers have a high positive correlation with the market.

U.S. retail sales rose broadly in October, and a gauge of manufacturing in New York state advanced in November, suggesting the economy could maintain momentum through the fourth quarter and pushing back recession fears.

With Italian benchmark bond yields closing above 7 percent and Spanish and French yields also higher, any market stability could evaporate if Italy's plans to form a new cabinet doesn't calm debt markets.

The danger is -- and the markets are keenly aware of this -- that this crisis, like most, turn on a dime and can blow up very, very quickly, said Oliver Pursche, president of Gary Goldberg Financial Services in Suffern, New York.

The Dow Jones industrial average <.DJI> gained 17.18 points, or 0.14 percent, to 12,096.16. The S&P 500 <.SPX> rose 6.03 points, or 0.48 percent, to 1,257.81. The Nasdaq Composite <.IXIC> added 28.98 points, or 1.09 percent, to 2,686.20.

The euro fell against the U.S. dollar, which has of late been an indicator of a declining stock market. The decoupling from this correlation could confirm the momentary shift in focus to the U.S. economy.

When Italian bond yields rose above 7 percent last week, the S&P 500 fell nearly 4 percent in one day. U.S. stock market trading has been marked by heightened volatility recently as much of it has been tied to news and market moves out of Europe.

In earnings news, Wal-Mart Stores Inc's quarterly profit missed expectations as the economy continues to weigh on customers in the United States, its largest division. Shares of the world's largest retailer dropped 2.4 percent to $57.46.

About 6.3 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, far below the year's current daily average of about 8 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of more than 8 to 5, while on the Nasdaq, about two stocks rose for every one that fell.

(Reporting by Rodrigo Campos; additional reporting by Edward Krudy; Editing by Kenneth Barry)