Stocks extended January's rally on Wednesday after upbeat global manufacturing data boosted sentiment and as Greece neared a long-delayed deal with private creditors.

The recent run of better-than-expected economic data around the world, though still not suggesting a booming expansion, has helped lift equity markets as investors move away from a worst-case scenario for the global economy.

An index of the U.S. manufacturing sector rose in January to its highest level since June, an industry group said, while China's factory sector expanded slightly, confounding expectations for a contraction. Germany recorded its first rise in manufacturing output in four months.

The numbers aren't horrible, the trend continues that the news is OK, said Brian Battle, vice president of trading at Performance Trust Capital Partners in Chicago. I think we're going to grind higher.

Optimism spurred gains in industrials, financials and basic materials, which rose between 1.1 percent and 1.7 percent. Caterpillar Inc , a company heavily exposed to global industry, rose 1.3 percent to $110.52 and was the biggest boost to the Dow industrials.

Trading volume was higher than it has been in recent days. Volume of the NYSE, Amex, and Nasdaq was 7.80 billion compared to its 20-day moving average of 6.97 billion. The wider participation comes after four down days when market movements were minimal and volume generally light.

Stocks also got a boost after Greek Finance Minister Evangelos Venizelos said talks between Athens and its private creditors were one formal step away from a deal needed to avoid a messy default. Such a deal would be a significant step in removing one of the biggest worries for investors.

U.S. and European banks rallied on the news. Bank of America Corp gained 3.2 percent to $7.36 and Citigroup rose 2.9 percent to $31.60.

The Dow Jones industrial average <.DJI> gained 83.55 points, or 0.66 percent, to 12,716.46. The Standard & Poor's 500 Index <.SPX> rose 11.67 points, or 0.89 percent, to 1,324.08. The Nasdaq Composite Index <.IXIC> climbed 34.43 points, or 1.22 percent, to 2,848.27.

After the S&P 500 rose 4.4 percent last month, some strategists see the benchmark approaching a short-term top. The index could be near the upper end of a trading band, with a top around 1,350, according to John Manley, chief equity strategist at Wells Fargo Funds Management in New York.

I'd rather own stocks than not, but on a year horizon, he said, indicating equities could pull back in the near term.

Homebuilder shares advanced after U.S. data showed construction spending surged in December to its highest level in more than 1-1/2 years. An index of housing stocks <.HGX> rose 1.8 percent. Shares in PulteGroup Inc
, the second largest U.S. homebuilder, rose 5.1 percent to $7.83.

Amazon.com Inc slid 7.7 percent to $179.46 a day after the online retailer warned of a possible first-quarter loss and posted a steep drop in fourth-quarter profit.

According to Thomson Reuters data, with 228 companies having

reported results, 61 percent have beaten expectations - below the 70 percent beat rate of recent quarters.

Whirlpool Corp surged 13.5 percent to $61.64 after giving an optimistic full-year outlook.

U.S. Treasuries prices fell on Wednesday as European risk assets improved, dampening demand for the safe-haven bonds, and as buying ebbed following a day of large month-end purchases.

Depressed Treasury yields, which point to caution on the part of investors, have been a reason for some to distrust a gain in stocks predicated on signs of an improving economy.

Facebook was expected to submit paperwork to regulators for a $5 billion initial public offering and selected Morgan Stanley and four other bookrunners to handle the IPO, sources told IFR, a unit of Thomson Reuters.

Morgan Stanley shares gained 4 percent to $19.39.

(Additional reporting by Rodrigo Campos; Editing by Padraic Cassidy)