S&P Logs 4-Day Win Streak Ahead of Holiday

Stocks closed higher in thin, choppy trading Wednesday ahead of the Thanksgiving holiday, after a cease-fire agreement between Israel and Hamas militants in the Gaza Strip, but some mixed economic reports and worries over Greece put a limit on gains.

The market will be closed on Thursday for Thanksgiving and will be open for a shortened session on Friday. (Read More: These 'Turkey Stocks' Soaked in Tryptophan?)

Symbol
Name
Price
 
Change
%Change
DJIA
---
NASDAQ
---
S&P 500
---

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."

Euro zone finance ministers failed to finalize the details of a debt-reduction package for Greece before the close of their meeting.

Still, European shares reversed their initial losses to close higher fter Reuters reported that German Chancellor Angela Merkel had told lawmakers at a closed-door meeting that lower interest rates and an expanded European Financial Stability Fund (EFSF) could fill Greece's financing gap.

Hewlett-Packard rose after plunging nearly 12 percent in the previous session following an $8.8 billion writedown related to its purchase of Autonomy last year. Still, at least three brokerages lowered their price target on the company, while another two cut their rating. (Read More: In Hewlett's Loss, a Folly Unfolds by the Numbers)

Among earnings, Deere fell after the equipment maker missed earnings expectations, though revenue exceeded consensus. Deere said it is seeing continued strength in demand for large equipment, but did note caution surrounding its U.S. livestock and dairy markets.

Salesforce.com soared to lead the S&P 500 gainers after the enterprise cloud computing company edged past earnings expectations and boosted its full-year 2013 revenue.

Scholastic plunged nearly 20 percent after the children's book publisher cut its guidance for the fiscal year amid lower sales in its high-margin educational business.

St. Jude Medical tumbled to lead the S&P 500 laggards after an inspection report from the FDA cited flaws in the medical device maker's oversight of design changes in its Durata line of implantable defibrillator leads. Wells Fargo lowered its rating on the stock to "market perform." Meanwhile, rival Boston Scientific rallied.

On the economic front, consumer sentiment rose to 82.7, according to the Reuters/University of Michigan consumer sentiment survey. Still, the reading was below projections for 84.5, according to a Reuters poll.

Weekly jobless claims fell to 410,000, according to the Labor Department, matching expectations from Reuters, but the report was still distorted by Hurricane Sandy.

And the leading economic indicator edged up in October, according to the Conference Board, pointing to modest economic expansion growth in the near term.

Meanwhile, U.S. manufacturing grew at its fastest pace in five months in November, according to financial information firm Markit's U.S. "flash" manufacturing PMI.

Weekly mortgage applications eased last week as interest rates ticked higher, though demand for new loans improved, according to the Mortgage Bankers Association.

Have a safe and happy Thanksgiving!

—By CNBC's JeeYeon Park (Follow JeeYeon on Twitter: @JeeYeonParkCNBC)

Coming Up This Week:

THURSDAY: Happy Thanksgiving! - Markets closed
FRIDAY: Black Friday - NYSE closes at 1pm ET / CME closes at 1:15pm ET

More From CNBC.com: