Stocks rallied on Wednesday, with all major indexes up more than 1 percent, as upbeat economic data from China and Germany eased concerns about the global economy, while Greece neared a long-delayed deal on a debt swap.

The Dow Jones industrial average <.DJI> rose 139.30 points, or 1.10 percent, to 12,772.21. The Standard & Poor's 500 Index <.SPX> added 13.90 points, or 1.06 percent, to 1,326.31. The Nasdaq Composite Index <.IXIC> climbed 27.44 points, or 0.98 percent, to 2,841.28.

(Reporting By Edward Krudy; editing by Jeffrey Benkoe)