(Reuters) - All three major U.S. stock indexes closed at record highs on Thursday for the first time since 1999 as surging oil prices and strong earnings from department stores Macy’s and Kohl’s buoyed investor sentiment.

It was the first time since Dec. 31, 1999 that the S&P 500, Dow Jones industrial average and Nasdaq had closed at record highs on the same day, according to Bespoke Investment Group.

Crude oil jumped as much as 5 percent on comments from the Saudi oil minister about potential action to stabilize prices and an International Energy Agency forecast that crude oil markets would rebalance in the next few months.

The S&P energy index .SPNY rallied 1.3 percent, making it the top gainer among the 10 major sectors, led by a 1.26 percent rise in Chevron CVX.N.

Macy's M.N shares soared 17.09 percent, marking the best day for the department store operator in nearly eight years after it reported a smaller-than-expected drop in quarterly comparable-store sales and said it would close 100 stores.

Kohl's KSS.N shares rose 16.17 percent after its quarterly profit beat estimates.

J.C. Penney JCP.N, which reports on Friday, surged 8.63 percent.

A stock market rally since late June has pushed the S&P 500 index .SPX up 7.0 percent in 2016, helped by better-than-expected quarterly earnings and low interest rates, but some investors are worried about high valuations.

Beating its previous record high from last Friday, the S&P 500 is priced at about 17 times expected earnings, compared with a 10-year average of 14 times expected earnings, according to Thomson Reuters data.

Traders work on the floor of the New York Stock Exchange (NYSE) shortly after the opening bell in New York, U.S., August 9, 2016. REUTERS/Lucas Jackson

“I’m a bit surprised to see us hitting record highs again,” said Randy Frederick, managing director of trading and derivatives for Charles Schwab in Austin. “We are pretty topped out and we should move sideways for a while.”

Robust U.S. economic data also helped on Thursday, with a report showing the number of Americans applying for unemployment benefits fell to 266,000 from 269,000 the previous week.

The Dow Jones industrial average .DJI climbed 0.64 percent to end at 18,613.52 and the S&P 500 .SPX gained 0.47 percent to 2,185.79.

The Nasdaq Composite .IXIC added 0.46 percent to 5,228.40.

While the Dow and S&P 500 have hit record highs in tandem in recent years, the Nasdaq went 15 years without hitting a new high before 2015. The Nasdaq surpassed its 2015 record high close last Friday.

In slow trade, about 5.98 billion shares changed hands on U.S. exchanges, compared with the 6.43 billion daily average over the last 20 sessions.

Alibaba BABA.N rose 5.08 percent after the Chinese e-commerce company posted a 59 percent jump in quarterly revenue.

Valeant VRX.N dropped 10.36 percent after the Wall Street Journal reported that U.S. federal prosecutors had opened a criminal investigation on the drugmaker.

Advancing issues outnumbered declining ones on the NYSE by a 1.63-to-1 ratio; on Nasdaq, a 1.76-to-1 ratio favored advancers.

The S&P 500 posted 34 new 52-week highs and no new lows; the Nasdaq Composite recorded 97 new highs and 29 new lows.