The Dow Jones Industrial Average rose 48.38 points, or 0.38 percent, to end at 12,836.89, led by Hewlett-Packard, after trading in a tight 60-point range all day. DuPont led the blue-chip laggards.

The S&P 500 added 3.22 points, or 0.23 percent, to close at 1,391.03. The Nasdaq gained 9.87 points, or 0.34 percent, to finish at 2,926.55. Both the S&P and Nasdaq ended higher for the fourth-straight session.

The CBOE Volatility Index, widely considered the best gauge of fear in the market, ended above 15.

Most key S&P sectors ended in positive territory, led by telecoms and energy.

Egypt announced a cease-fire agreement to end fighting between Israel and Hamas militants in the Gaza Strip. The cease-fire took effect at 2pm ET. Oil prices closed off their highs following the news.

Stocks finished largely unchanged in the previous session as Federal Reserve Chairman Ben Bernanke's negative comments on the looming "fiscal cliff" added to ongoing worries. (Read More: Is Bernanke Right About the 'Fiscal Cliff'?)

Policymakers are not expected to return to negotiations until next week.

"We have this vacuum on the 'fiscal cliff'—that's a mild positive under the market. Then Congress comes back next week so there might be some untoward comments," said Art Cashin, director of floor operations at UBS Financial Services. "There's a mild upward historic bias to today and also the abbreviated session on Friday."