Stocks extended January's rally, climbing more than 1 percent on Wednesday after upbeat global manufacturing data and as Greece neared a long-delayed deal with private creditors.

The recent run of better-than-expected economic data around the globe has helped lift world 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.

Optimism over the economy spurred gains in industrials, financials and basic materials, which rose between 1.5 percent and 2 percent. Caterpillar Inc , a company heavily exposed to global industry, rose 1.6 percent to $110.88 and was the biggest boost to the Dow industrials.

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.

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.

U.S. and European banks rallied on the news. Bank of America gained 3.5 percent to $7.39 and Citigroup rose 4 percent to $31.94.

The Dow Jones industrial average <.DJI> gained 125.07 points, or 0.99 percent, to 12,757.98. The Standard & Poor's 500 Index <.SPX> rose 15.62 points, or 1.19 percent, to 1,328.03. The Nasdaq Composite Index <.IXIC> added 37.31 points, or 1.33 percent, to 2,851.15.

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.9 percent.

Amazon slid 7.9 percent to $179.10 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 surged 17.7 percent to $63.91 after giving an optimistic full-year outlook.

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 Reuters unit IFR.

Morgan Stanley shares gained 5.4 percent to $19.66.

(Reporting by Edward Krudy, additional reporting by Chuck Mikolajczak; editing by Kenneth Barry)