The tech-heavy Nasdaq Composite claimed a second consecutive record Wednesday while broader stock indexes slipped in a quiet trading session.

With major indexes trading near all-time highs, investors are parsing signals about the path of the economy and the intentions of the Federal Reserve as they consider how much more of a rally might be in store.

The S&P 500 fell 4.60 points, or 0.1%, to 4241.84, off 0.3% from its record close last week. The Dow Jones Industrial Average dropped 71.34 points, or 0.2%, to 33874.24. The Nasdaq Composite gained 18.46 points, or 0.1%, to 14271.73, its 16th record close of 2021.

For much of this year, stocks have surged from their pandemic-induced lows, buoyed by a strengthening economy, supportive monetary policy and plentiful government spending. The S&P 500 has gained 90% since its closing low in March 2020.

Investors are struggling to discern the path forward and have lately focused on signs of inflation, which could lead the Fed to lift interest rates from the near-zero levels adopted in response to the Covid-19 pandemic. Low rates boost the value of future cash flows in commonly used stock valuation models.

For much of this year, stocks have surged from their pandemic-induced lows.

For much of this year, stocks have surged from their pandemic-induced lows.

Photo: Nicole Pereira/NYSE/Associated Press

Stocks sold off last week after Fed officials signaled that they expect to raise interest rates by late 2023, sooner than they had previously anticipated, because of the strong economic rebound and jump in inflation.

But major indexes have rebounded this week, with many investors noting that a strong economy should support stocks, even if interest rates eventually rise. Fed Chairman Jerome Powell reiterated Tuesday that the recent increase in inflation will likely prove temporary.

“I think the market’s still wrestling with where are we in terms of the Fed,” said Cliff Corso, president and chief investment officer at Advisors Asset Management. ”The market’s looking for the economic clues day by day and then probably trying to graft those clues onto the projection for the Fed’s mentality.”

Energy stocks posted gains Wednesday as Brent crude, the global oil benchmark, rose 0.5% to $75.19 a barrel. The consumer discretionary and financial sectors of the S&P 500 also rose.

As the market rally stretches on, investors continue to evaluate different sectors and types of companies. For the year so far, value stocks—which tend to have a low price relative to their overall value—have gained more than growth stocks.

Related Video

The Federal Reserve is considering digitizing the dollar, giving people money they can access on their phone and bypassing electronic payments that can be slow and costly for businesses. The Wall Street Journal Interactive Edition

But within the second quarter it has been a different story, with the Russell 1000 Growth Index up 9.9%, compared with a 3.8% rise in the Russell 1000 Value Index.

“Investors might be consolidating gains because there’s really not much more room in terms of the reopening trade,” said Anu Gaggar, senior global investment analyst at Commonwealth Financial Network.

Another possible message from the rotation, she said, is that the market is concerned that the Fed could overdo interest rate increases and stifle the pace of economic growth, hurting some economically sensitive value stocks.

Among individual stocks Wednesday, shares of Fannie Mae and Freddie Mac plunged more than 30% after the Supreme Court rejected most claims by investors who challenged a government decision to channel the mortgage giants’ profits to the Treasury Department.

In bond markets, the yield on the 10-year U.S. Treasury note rose to 1.486%, from 1.471% on Tuesday. Yields rise as bond prices fall.

Overseas, the Stoxx Europe 600 dropped 0.7%. Japan’s Nikkei 225 closed down less than 0.1%, while Hong Kong’s Hang Seng Index gained 1.8%.

Write to Joe Wallace at Joe.Wallace@wsj.com and Karen Langley at karen.langley@wsj.com