Stocks Close Near Highs, All S&P Sectors Gain

Stocks rallied more than 1 percent across the board Tuesday, wiping out most of the previous day's declines, but investors remained cautious amid the ongoing uncertainty in the euro zone.

Shortly after the closing bell, Dell announced it will initiate a $0.08 quarterly dividend beginning in the third quarter. Shares rallied in extended-hours trading.

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

The Dow Jones Industrial Average rallied 162.57 points, or 1.31 percent, to finish at 12,573.80, led by Boeing after Bernstein boosted its rating on the company to "outperform" and raised its price target to $92 from $85. JPMorgan and BofA also jumped.

United Tech was the only laggard on the blue-chip index.

The S&P 500 rose 15.25 points, or 1.17 percent, to end at 1,324.18. The Nasdaq jumped 33.34 points, or 1.19 percent, to close at 2,843.07.

The CBOE Volatility Index, widely considered the best gauge of fear in the market, slipped near 22.

All key S&P sectors ended in positive territory, led by financials and materials.

“Investors can expect persistent volatility for the foreseeable future—buckle your seatbelt,” said Mark Martiak, senior wealth strategist at Premier/First Allied Securities. “Volume will remain lower and this will be a trader’s market even though investors should still remain balanced.”

Earlier in the session, Fitch downgraded the long-term ratings on 18 Spanish banks, but investors seemed to shrug off the news. Fitch's bank downgrades come after the agency lowered Spain's sovereign credit ratinglast week to "BBB." The Spanish 10-year bond yield hit its euro-era high at 6.807 percent.

“It’s surprising how quickly the market looks forward—we’re still held by the European issues and that’s all the U.S. market seems to care about,” said Ryan Detrick, senior technical strategist at Schaeffer’s Investment Research. “We’re just waiting for events to happen almost as quickly as they happen.”

Still, Detrick said he remains bullish based on the negative sentiment among traders and investors.

“The fact that we didn’t break below 1,298 [on the S&P 500]…it seems like we’re trying to carve out a pretty substantial bottom,” he said. “The potential for a second-half surprise rally in the face of negative news is real.”

European shares recovered to close higherin choppy trade as investors shrugged off the Fitch downgrade. But sentiment remained cautious ahead of Greece's election on June 17, seen as a referendum on the debt-ridden nation's future in the euro zone.

Apple edged higher after Canaccord Genuity raised its price target on the tech giant to $800 from $775. The upgrade comes a day after Apple's annual Worldwide Developers Conferencelargely failed to impress investors, even after the company unveiled its next-generation MacBook Air and MacBook Pro laptops in addition to a new version of its mobile operating system, iOS 6. (Read More: Apple Stock at $1,000? Analysts Say Within Two Years)

Facebook rose to close above $27 a share. Meanwhile, Needham reiterated its "buy" rating on the social-networking giant.

Zynga plunged to its lowest level since going public last December, amid worries that the Facebook-gaming fad has passed its peak.

Among earnings, Michael Kors jumped after the designer clothing and handbag maker beat profit expectations and handed in a full-year earnings and revenue forecast that exceeded estimates.

Texas Instruments climbed after the chipmaker narrowed its second-quarter forecast. Meanwhile, at least three brokerages cut their price target on the firm.

Juniper Networks gained after the data network equipment maker announced a stock buyback of up to $1 billion.

A123 Systems soared after the electric-car battery maker announced it has developed a lithium ion battery technologythat wouldn't need cooling and heating systems and lower the price of electric vehicles.

JPMorgan's CEO Jamie Dimon is scheduled to testify before the U.S. Senate Banking committee on Wednesday, a month after the bank revealed a failed hedging strategy that produced a loss of at least $2 billion.

On the economic front, import prices recorded their biggest decline in almost two years in May, according to the Labor Department. Meanwhile, export prices slipped for the first time since December.

Treasury prices slippedafter the government auctioned $32 billion in 3-year notes at a high yield of 0.387 percent and bid-to-cover of 3.53.

The National Federation of Independent Business Small Business Optimism Index for May showed a slight decline amid the political and economic uncertainty.

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

Coming Up This Week:

WEDNESDAY: Weekly mortgage apps, PPI, retail sales, business inventories, oil inventories, 10-yr note auction, OPEC mtg, Caterpillar shareholders mtg, Dimon testifies before Senate
THURSDAY: CPI, jobless claims, current account, 30-yr bond auction, AOL shareholders mtg; Earnings from Kroger, Smithfield Foods, Pier 1 Imports
FRIDAY: Empire state mfg survey, treasury int'l capital, industrial production, consumer sentiment, credit card default rates reported, quadruple witching

More From CNBC.com: