The Dow on Wednesday eked out a slight gain to log its best record-setting streak in three decades, but the broader equity benchmarks struggled as Federal Reserve minutes implied that the central bank is comfortable with raising interest rates “fairly soon.”

The Dow Jones Industrial Average DJIA, -0.87% added 32.60 points, or 0.2%, to end at 20,775.60—the ninth record close in a row, its longest run since 1987, according to the Dow Jones data.

The S&P 500 index SPX, -1.11% declined 2.56 points, or 0.1%, to finish at 2,362.82, dragged down by energy shares which fell 1.6% as oil prices US:CLJ7 tumbled.

The Nasdaq Composite Index COMP, -1.07% shed 5.32 points to end at 5,860.63.

“A rate increase in March is most likely on the table even though the minutes don’t necessarily indicate that and it seems the Fed is prepping the market for it,” said Bob Pavlik, chief market strategist at Boston Private Wealth.

“Many” Federal Reserve officials indicated their support for raising rates if the economy continued to strengthen, according to the minutes of the Fed meeting earlier this month. But the transcript also showed a mood of uncertainty over President Donald Trump’s fiscal policy plans, which have been the biggest boost to stocks during the past few months.

The risks facing the U.S. economy are more in balance, allowing the Fed to gradually raise interest rates, said Gov. Jerome Powell to the Forecaster’s Club of New York.

Meanwhile, some analysts warned that the rally on Wall Street and overly complacent attitude among investors are creating a dangerous situation.

“Make no mistake, lowering taxes is truly pro-growth and will keep the strong undertone of growth moving ahead. This will, however, mean a tighter monetary policy. Although we recognize that rates are below normal, the fact is that when the tightening process begins, the ‘full speed ahead’ of climbing stocks will run into a brick wall,” said Peter Cardillo, chief market economist at First Standard Financial, in emailed notes.

Opinion:Market timing is out of favor—so is a stock-market top near?

Stock movers: Shares of Toll Brothers Inc. TOL, +0.90% jumped 6.1% after posting a fall in profit and revenue, but rising contracts in five of its markets.

Dish Network Corp. DISH, -3.05% shares fell 0.7%, reversing gains that followed news that the company swung to a profit on an increase in subscribers.

Garmin Ltd. GRMN, -1.90% earnings results in the latest quarters came in much better than expected, sending shares up 7.3%. The stock is up 32% over the past 12 months.

First Solar Inc. FSLR, -3.51% shares dropped 8.4% as the solar-panel maker reported that it swung to a loss on restructuring charges.

Shares of Bristol-Myers Squibb Co. BMY, -0.23% rose 1% after news late Tuesday that Carl Icahn has taken a stake in the New York drugmaker. Icahn, who owns a large stake, believes the company’s pipeline of drugs would make it an attractive takeover candidate, according to The Wall Street Journal.

Barron’s on why GM shares are zooming higher

Other markets: Asian markets ADOW, +0.33% mostly rose with the Hong Kong Hang Seng Index HSI, +0.47% up 1%. European stocks SXXP, -0.66% eased across the board.

The 10-year Treasury yield fell 1 basis point to 2.41%. The dollar gained against the euro EURUSD, , but slipped against the yen. Gold prices US:GCJ7 settled lower.

--Barbara Kollmeyer contributed to this article.