The Dow industrials on Thursday logged a seventh consecutive all-time high, but the broader market closed lower following a slump in the energy sector.

The Dow Jones Industrial Average
DJIA, -0.27%
added 9.86 points, or less than 0.1%, at 22,026.10, supported by gains in Pfizer Inc.
PFE, -0.04%
but pressured by a decline in Goldman Sachs Group Inc., down 1%, and similar drop in Apple Inc.
AAPL, +0.03%
after a run-up in the iPhone maker’s stock on the heels of its well-received quarterly results.

The blue-chip gauge has notched 33 record closes in 2017. It is on its longest winning streak, at eight sessions, since the 12-session period ended Feb. 27.

The energy-focused Energy Select Sector SPDR ETF
XLE, -1.45%
a popular way to make bets on the sector, closed off 1.4%, marking its worst one-day slide since July 5 when it fell 2%, according to FactSet data.

Selling in energy stocks coincided with a retrenchment in crude-oil futures, with West Texas Intermediate futures traded on the New York Mercantile Exchange
US:CLU7 settling off 1.1% lower at $49.03 a barrel.

Meanwhile, the technology-laden Nasdaq Composite Index
COMP, +0.05%
gave up 22.30 points, or 0.4%, at 6,340.34.

“Energy is primarily the only thing that [kept] the S&P from being in positive territory,” said Michael Antonelli, equity sales trader at Robert W. Baird & Co.

Antonelli said investors are also taking a step back from recent gains. “Investors are leaning a little bit more cautiously simply for the very, very near term because of bullish sentiment being higher than normal,” he said.

Antonelli also said the tendency of August to be a weak month for returns is giving investors reason to hold back from buying stocks.

On the economic front, a closely watched service-sector report from the Institute for Supply Management indicated that nonmanufacturing activity, also known as services, fell to 53.9% in July from 57.4% in June.

Services’ slowing pace comes after an early reading of employment didn’t stoke much of a market reaction, showing weekly jobless claims holding at a 44-year low, underlining the health of the labor market. Initial jobless claims from July 23 to July 29 declined by 5,000 to 240,000, while the average of new claims over the past month fell to 241,750.

Randy Frederick, managing director of trading and derivatives at Schwab Center for Financial Research, said Thursday’s pullback for stocks wasn’t atypical of a market that has hit repeat records in the past year, fueled in part by hope for better corporate results and a pro-business atmosphere fostered by President Donald Trump’s administration.

“Every time we see a major index hit a milestone…you see a little sideways action or a pullback. It’s not at all uncommon,” Frederick said.

Worries that equities are rising too quickly have stoked some fears that a severe, near-term downdraft is imminent, but the Schwab analyst said the case for bullishness is still prevailing.

Upbeat earnings, relatively low rates and a downturn in the dollar
DXY, -0.22%
which supports revenues from multinational corporations, should offer tailwinds.

The Dow briefly skittered lower after The Wall Street Journal reported that Special Counsel Robert Mueller has impaneled a grand jury in Washington to investigate Russia’s interference in the 2016 elections, signaling that that investigation is intensifying.

Kellogg Co. shares
K, +1.57%
rose 4.3% after the Frosted Flakes producer delivered better-than-expected second-quarter results. Net income was $282 million, or 80 cents per share, up from $280 million, or 79 cents per share, for the same period last year. Adjusted earnings-per-share was 97 cents, beating the 92-cent FactSet consensus.

Allergan PLCAGN, -0.99%
shares added less than 0.1% as the drugmaker lifted its full-year guidance for revenue in 2017 to $15.85 billion, compared with prior guidance of $15.8 billion.

Tableau Software Inc.DATA, +1.68%
shares rose 9% after the data analytics company posted a surprise profit for the quarter late Wednesday.

Aetna Inc.‘s
AET, -0.06%
shares climbed 2.5% after the health-care company’s second-quarter earnings beat analyst forecasts. Profit for the quarter came in at $1.2 billion, or $3.60 a share, up from $791 million, or $2.23 a share, a year ago.

Intraday Data provided by SIX Financial Information and subject to terms of use. Historical and current end-of-day data provided by SIX Financial Information. All quotes are in local exchange time. Real-time last sale data for U.S. stock quotes reflect trades reported through Nasdaq only. Intraday data delayed at least 15 minutes or per exchange requirements.