Stocks Log 4-Day Rally; Dow, S&P End at Log Fresh Closing Highs; HPQ Slumps 6%

Stocks ended higher Thursday lifted by an upbeat jobless claims report, with the Dow and S&P 500 closing at fresh levels, while weakness in large tech companies limited gains on the Nasdaq.

(Read More: After-Hours Buzz: JBHT, GPS & More)

"The market seems to be on autopilot," said Joe Saluzzi, co-manager of trading at Themis Trading. "Everyone believes there are some serious issues being overlooked, but no one wants to fight a momentum-fueled rally…Plus, we've been on very light volume; when you see rallies, you want to see buyers."

(Read More: 'Amazed' Cramer Tells Why This Rally Is 'Very Unusual')

S&P 500

The Dow Jones Industrial Average advanced for the fourth-consecutive session, gaining 62.90 points to end at 14,865.14, lifted by Pfizer and Travelers. Hewlett-Packard dropped more than 6 percent.

The S&P 500 rose 5.64 points to finish at 1,593.37. The Nasdaq eked out a gain of 2.90 points to close at 3,300.16.

The S&P and Nasdaq are on pace for their second best weekly gains for the year.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, ended above 12.

Most key S&P sectors closed in positive territory, led by consumer discretionary and telecoms, while techs remained lower.

Shares of major tech companies including Microsoft, Hewlett-Packard and Intel slumped sharply after market research firm IDC said worldwide shipments of personal computers tumbled 13.9 percent in the first quarter, the biggest drop since the firm began issuing quarterly numbers in 1994. At least three brokerages downgraded Microsoft.

(Read More: Suckers! Tech Execs Selling Stock at Record Pace)

"Forget [S&P] 1,660, 1,700, etc.. You should be concerned about protecting big gains," wrote Elliot Spar, market strategist at Stifel Nicolaus. "With new money, be selective and patient...This is not the 1st quarter anymore. You'll have to work harder to get on base and then stay close to the bag."

Retailers were among the day's strongest performers. L Brands (formerly Limited Brands) and Ross Stores rallied after both firms posted higher-than-expected same-store sales in March. Meanwhile, top retailers Costco and TJX reported weaker-than-expected sales, but still traded higher along with the broader market.

JCPenney jumped after three more top executives at the retailer parted ways with the company, according to a New York Post report, following the ouster of Chief Executive Ron Johnson.

Herbalife gained after the SEC charged former KPMG partner Scott London and his friend Bryan Shaw for insider trading. In recorded conversations, London told Shaw specific details about earnings announcements for Herbalife and another KPMG client Deckers. And in one call, London referenced rumors that had been spread about Herbalife going private.

Among earnings, Rite Aid surged after the pharmacy chain posted its second consecutive quarterly profit as the company filled more prescriptions and sold more generic drugs.

Pier 1 Imports slid after the furniture retailer posted earnings that were mostly in line with expectations, but handed in a weaker-than-expected outlook.

Banking giants JPMorgan and Wells Fargo are slated to post earnings on Friday. (Vote Now: Will JPMorgan Meet, Beat, Miss?)

On the economic front, weekly jobless claims declined 42,000 to a seasonally adjusted 346,000, according to the Labor Department, after a huge jump in the prior week. Economists polled by Reuters had expected a reading of 365,000.

Import prices fell in March as weak petroleum costs offset a spike in food prices, according to the Labor Department, matching expectations. The tame inflation environment should allow the Federal Reserve to stay on its ultra-easy monetary policy course as it tries to nurse the economy back to health.

On Wednesday, minutes from the Fed's March meeting released suggested some policymakers expect to slow the pace of asset purchases by mid-year and end them later this year. Under its current quantitative easing program, the Fed purchases $85 billion in Treasurys and mortgage-backed securities each month.

Still, the market rally continued despite concerns about when the central bank might start to pull back its stimulus efforts amid the healing U.S. economy.

Treasury prices eased off their highs after the government sold $13 billion in 30-year bonds at a high yield of 2.998 percent. The bid-to-cover ratio, an indicator of demand, was 2.49.

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

Coming Up This Week:

FRIDAY: PPI, retail sales, consumer sentiment, business inventories, Bernanke speaks at Fed's development conf.; Earnings from JPMorgan, Wells Fargo

More From