Stocks ended mostly higher after a late rally Tuesday as banks and materials rebounded. But tech stocks remained under pressure as investors worried about the sector's European exposure.
The Dow Jones Industrial Average rose 123.49, or 1.3 percent, to close at 9,939.98, after a see-saw session. That helped erase all of the 115-point drop from the previous session.
The S&P 500also gained more than 1 percent but the tech-heavy Nasdaqslipped. The CBOE volatility index, widely considered the best gauge of fear in the market, was around 33 at the closing bell.
“The markets are trying to stabilize after a fairly significant selloff,” said Alan Gayle, senior investment strategist for RidgeWorth Investments.
Gayle expects a sideways market through the summer and remains cautious on the market because of international uncertainties in Europe and China.
Offering some words of encouragement, Fed Chairman Ben Bernanke said he thinks the economy will avoid a double-dip recession but cautioned it won't be smooth sailing. The Fed chairman was speaking at the Woodrow Wilson International Center for Scholars, a nonpartisan research group.
"My best guess is we will have a continued recovery, but it won't feel terrific," Bernanke said, adding that economic growth won't be robust enough to drive down the unemployment rate, currently at 9.7 percent.
In Europe, finance ministers also attempted to restore market confidence by agreeing how to launch a massive anti-contagion program if necessary.
But it seems like each day brings a different country to worry about. Yesterday, it was Hungary. Today, it's Bulgaria. The EU has "some concerns" about Bulgaria, EU Economic Affairs Commissioner Olli Rehn said Tuesday.
The euro rose slightlybut was still near four-year lows against the dollar on Tuesday.
Investors seemed to be buying in to some beaten-down sectors of late, including financials and materials.
Citigroup and Bank of America advanced but Rochdale analyst Dick Bove cut his price targetand earnings forecast on JPMorgan , saying the brokerage is "facing challenges in its business model almost everywhere."
This came after Bove last week slashed his price target and forecastfor Goldman Sachs .
Oil settled at $71.99 a barrelon Tuesday as investor worries faded that Europe's debt crisis would curb the demand for energy. And gold closed at a record $1,244.30 an ounce.
Goldman Sachs downgraded deepwater drillers, saying the current six-month moratorium on deepwater drilling could be extended.
BP and Transocean both lost more than 5 percent while Diamond Offshore also skidded following news that a deep-water drill owned by the company in the Gulf may be leaking oil.
Tech stocks took a hit amid worries about the sector's European exposure as many make a good chunk of their income overseas.
Intel was one of the few decliners on the Dow after the chip giant was downgraded to "neutral" by SIG Susquehanna, which cited a weakening PC market.Microsoft
was also among the Dow decliners as the tech giant announced it is planning a private offering of senior notes and will use the proceeds to repay short-term debt.
Meanwhile, Bank of America-Merrill Lynch cut price targets on seven Internet stocks, including Google , Amazon and eBay , citing worries about earnings due to the strengthening dollar.
The latest iPhone hit store shelves on Monday, as Apple attempts to stay one step ahead of rivals like Googlein the smartphone market. The new $199 "iPhone 4" is a quarter slimmer than the current handset and with about double the picture quality. It also sports the in-house A4 processor and allows video chat.
Shares of Corning jumped over 6 percent, making it one of the top gainers on the S&P 500, after Sanford C. Bernstein upgraded the company, which makes glass used in televisions and other products, to "outperform" from "market perform" saying it expects demand from the mobile-phone industry to drive sales for the company.
U.S.-traded shares of the iPhone maker's rivals Nokia , Ericsson and Research In Motion were also higher.
Meanwhile, Caterpillar shares rose after the machinery company affirmed its long-term profit target, saying it still expects to earn $8 to $10 per share in 2012, and its incoming chief executive said he feels "personally energized" about taking on the firm's competitors.
McDonald's shares rose after the fast-food giant reported a larger-than-expected 4.8 percent rise in global sales for May.
Talbot's beat earnings expectations and affirmed its full-year outlook, but shares fell nearly 10 percent.
And Depomed said its market application for an experimental pain drug had received FDA approval, triggering a $10 million milestone payment from the drug's licensee. But shares were lower.
Treasurys pared their losses slightly after a strong auction of three-year notes. The $36 billion sale fetched a high yield of 1.220 percent and the bid-to-cover ratio was 3.23.
Auctions of 10-year and 30-year bonds are expected in the next two days, respectively.
In the day's economic news, small business owners in the U.S. said they are more optimistic about the recoveryabout the recovery in a May survey than they have been in the past two years.
Volume was slightly above average, with 1.65 billion shares changing hands on the New York Stocks Exchange. Advancers outpaced decliners, roughly 3 to 2.
WEDNESDAY: Weekly mortgage apps; wholesale trade; 10-yr note auction; Fed's beige book; Bernanke speaks; Fed's Lacker speaks; Caterpillar shareholders meeting
THURDSAY: International trade; weekly jobless claims; quarterly services survey; 30-yr bond auction; Treasury budget; Earnings from: Del Monte Foods, National Semiconductor
FRIDAY: Fed's Plosser and Kocherlakota speak; retail sales; consumer sentiment; business inventories; S&P index rebalancing details announced
More From CNBC.com: