NEW YORK (TheStreet) -- After four sessions of losses, stocks rallied back to record levels on Thursday, helped by continued weakness in the U.S. dollar.

The S&P 500 closed just above its previous record, while the Dow Jones Industrial Average hovered within 40 points of its high.

After four days of selling, investors were cheered as the dollar weakened further, Treasury yields stabilized and tech and materials stocks rallied.

The S&P 500 was up 1.1% to 2,120, above a record closing level of 2,117 on April 24. The Nasdaq climbed 1.4%. The Dow added 1%, situating it around 40 points off its record high.

The U.S. dollar fell 0.5% against the euro, 0.2% against the British pound, and 0.4% against the Swiss franc. The greenback hit 11-year highs earlier this year which proved troublesome for many multinationals' top-lines during the first quarter.

U.S. Treasury yields stabilized on Thursday, falling back from five-month highs seen earlier this week. The yield on the 10-year Treasury fell to 2.24%.

"We have dollar weakness today. That continues to hold the key," Peter Cardillo, chief market economist at Rockwell Global Capital, told CNBC. "There is complacency in the bond market and that's helping to ease that fear of yields climbing."

High-momentum tech stocks including Apple (AAPL), Microsoft (MSFT) and Amazon (AMZN) rose, while the Technology SPDR ETF (XLK) added 1.6%.

Materials stocks gained as crude oil stabilized around $60 a barrel. BHP Billiton (BHP), Rio Tinto (RIO), and Vale SA (VALE) were each higher. The Materials Select Sector SPDR ETF (XLB) gained 1%.

Weekly jobless claims remained at a 15-year low, indicative of a tightening labor market. The number of people applying for unemployment benefits in the week ended May 9 fell 1,000 to 264,000. Economists had expected claims to rise to 275,000.

The four-week moving average fell to 272,000, its lowest level since April 2000, said Cheng Chen, TD Securities' U.S. strategist.

"It suggests that claims remain on a broadly improving trajectory, and we expect the positive tone for labor market momentum over the coming months to be sustained," he said.

U.S. producer prices fell for the seventh time in nine months in April, down 0.4%, as lower gas and food costs continued to cause headwinds for the economy. Economists had expected no change after a 0.2% increase in March.

Avon Products (AVP) shares were higher, though had pared explosive gains seen earlier following a bizarre hoax in which the company received a bid from PTG Capital Partners nearly triple Wednesday's closing price. Avon said it could not confirm the offer nor whether PTG even exists. Click here for more.

JPMorgan (JPM) shares were on watch after announcing it will purchase the mortgage servicing rights for 266,000 high-quality Fannie Mae (FNMA) loans. The loans, worth an estimated $45 billion, will be purchased from a subsidiary of Ocwen Financial (OCN). Click here for more.

Cisco (CSCO) shares slipped 1% despite a quarterly earnings beat. The tech giant reported earnings of 54 cents a share, just edging out estimates of 53 cents. Revenue rose 5.1% to $12.1 billion, slightly better than estimates of $12.07 billion. Click here for more.

Shake Shack (SHAK) reported its first quarterly results since going public. The burger chain earned 4 cents a share, better than an estimated loss of 3 cents, while revenue jumped 56.3% from a year earlier.

J.C. Penney (JCP) was lower despite reporting a loss of 55 cents a share, far narrower than estimates of a loss of 77 cents. Revenue climbed 2% to $2.857 billion. Click here for more.

Kohl's (KSS) fell more than 13% after sales missed estimates. The retail chain reported revenue of $4.12 billion, up 1.2% from a year earlier, though revenue fell short of estimates by $70 million. Comparable-store sales rose 1.4% in its fiscal first quarter.

More from Markets

Global Stocks Rally as US-China Trade War Thaws; Dow Could Test 25,000

Global Stocks Rally as US-China Trade War Thaws; Dow Could Test 25,000

Tesla Jumps on Model 3 Expansion Hopes, China Trade Truce

Tesla Jumps on Model 3 Expansion Hopes, China Trade Truce

Apple Gains as U.S. China Trade Tensions Ease After Weekend Summit

Apple Gains as U.S. China Trade Tensions Ease After Weekend Summit

Video: There Are Some Big Changes Coming to the PGA Championships in 2019

Video: There Are Some Big Changes Coming to the PGA Championships in 2019

Video: One-on-One With Pluralsight's CEO Following Its Successful IPO

Video: One-on-One With Pluralsight's CEO Following Its Successful IPO