The S&P 500 advanced more than 4 percent while the Dow and Nasdaq added to gains on Thursday on optimism about an agreement to help tackle the European debt crisis.

The Dow Jones industrial average was up 390.79 points, or 3.29 percent, at 12,259.83. The Standard & Poor's 500 Index was up 47.91 points, or 3.86 percent, at 1,289.91, after rising more than 4 percent. The Nasdaq Composite Index was up 98.42 points, or 3.71 percent, at 2,749.09.