The Dow closed at a record for a third session in a row on Thursday even as the broader market sagged on the back of weak retail shares.

The S&P 500 index SPX, -1.11% shed 2.75 points, or 0.1%, to end at 2,495.62. Consumer sectors were the hardest hit, with Tiffany & Co. down 4.8%, and Kroger Co. KR, +2.15% falling 2.2%.

The Dow Jones Industrial Average DJIA, -0.87% gained 45.30 points, or 0.2%, to finish at 22,203.48, marking its 38th record finish of 2017.

The Nasdaq Composite Index COMP, -1.07% , meanwhile, slipped 31.10 points, or 0.5%, to end at 6,429.08.

A reading on consumer prices, known as the consumer-price index, showed an increase of 0.4% in August, beating consensus estimates for a rise of 0.3%, while first-time jobless claims last week came in at 284,000, versus forecasts for 300,000.

Kate Warne, investment strategist at Edward Jones, said Thursday’s data did little to alter the policy path for the Federal Reserve. Inflation data offered the first read of some of the impact of Hurricane Harvey, which inundated the Houston area and resulted in the shutdown of a trove of crude-oil refineries, driving gasoline prices higher.

“CPI was a bit above expectations,” but market participants can’t be surprised that higher gasoline prices and some other expected inputs moved inflation toward the Fed’s 2% target, Warne said. She said the report was “not so strong that it’s likely to change views that the Fed will continue to be cautious and slow in raising interest rates.”

Inflation readings have been trending below the Federal Reserve’s target and leading some to question whether the central bank would feel comfortable lifting benchmark interest rates once more in 2017.

On Wednesday, the S&P 500, Dow and Nasdaq Composite all gained between 0.1% and 0.2%, finishing at all-time closing highs for a second straight session.

The equity market’s continued run to new heights, with the bull market in its ninth year, has raised concerns about lofty stock valuations.

“The S&P 500 continues to confound skeptical investors, as it adds to its above-average number of new highs,” said Sam Stovall, CFRA’s chief investment strategist, in a note. The benchmark has scored 33 record closes this year, more than twice the annual average since 1945.

However, Mark Kepner, managing director of sales and trading at Themis Trading, said he was sanguine about the outlook for the stock market. “If you look at the market and you look at the backdrop for equities, it is still pretty good right now,” he said.

“Yeah, you always could run into this situation where you can have a 5% correction. That is always a possibility,” he said. “But I do not see any major structural issues with the market that could turn into a bear market,” Kepner added, referring to a decline of at least 20%.

Read: Stock market’s 5-month win streak should cheer the bulls

Earlier Thursday, North Korea made more threats in response to the latest United Nation sanctions, vowing to sink Japan with a nuclear weapon and “reduce the U.S. mainland to ashes and darkness.”

The acerbic rhetoric comes after the U.N. Security Council on Monday unanimously adopted tougher sanctions against North Korea targeting its exports and oil imports.

Economic and political news: The Bank of England on Thursday kept its key interest rate on hold and made no changes to its quantitative-easing program, but warned that rates could rise faster than traders currently are pricing in.

The ICE U.S. Dollar Index DXY, -0.03% slid 0.4% despite the better-than-expected economic readings, but it has gained about 1% this week, paring its year-to-date loss to around 9.6%.

On the political front, President Donald Trump and top Democrats appear to be nearing a deal to give legal status to the children of illegal immigrants. Trump tweeted early Thursday that no deal had been reached yet, after Democrats late Wednesday said they had an agreement with him to enact protections for “Dreamers” in exchange for increased border-security measures that don’t include funding for a wall.

See:Orrin Hatch says corporate tax rate could go as low as 20%

Other markets: European stocks SXXP, -0.66% bounced around, while Asian markets closed with losses after weaker-than-anticipated data on China’s industrial activity.

Crude-oil futures US:CLV7 finished stronger, at one point retaking $50 a barrel for the first time since July. Gold futures US:GCZ7 settled slightly higher.

Jamie Dimon Calls Bitcoin 'a Fraud'

Stocks to watch: Shares in Equifax Inc. EFX, -2.03% fell 2.4%, putting the credit-reporting company’s stock on track to extend a huge selloff sparked by its disclosure last week of a massive data breach. The FTC on Thursday said it was opening an investigation into the breach.

See: Equifax down 31% since breach disclosure, erasing $5 billion in market cap

Lattice Semiconductor Corp.’s stock LSCC, -1.05% rose 0.4% after Trump nixed a pending buyout of the chip company by a group of Chinese investment funds, citing national security concerns.

Shares of William Lyon Homes US:WLH slumped 5.3% lower after hedge-fund Paulson & Co. said it would sell its stake in the home builder.

Bed Bath & Beyond BBBY, -1.33% shares were down 1.7% after its price-target was cut by UBS on Friday to $30 from $33.

Apple Inc.’s stock AAPL, -3.17% closed 0.9% lower after revealing details on its new iPhone lineup and other tech gadgets.

Check out: How to get Apple’s new iPhone for half price

See: Trump stops China from buying into U.S. chip industry, but what’s next?

--Victor Reklaitis contributed to this report.