By Anna Hirtenstein and Dawn Lim

U.S. stocks edged lower Wednesday, a day after the S&P 500 set its first record close since February, after Federal Reserve officials highlighted the uncertainties facing the economy.

The broad stock-market index fell 14.93 points, or 0.4%, to 3374.85. The Dow Jones Industrial Average declined 85.19 points, or 0.3% to 27692.88. The technology-heavy Nasdaq Composite fell 64.38 points, or 0.6% to 11146.46.

The S&P 500 has surged more than 50% from its lows in March and is up more than 5% for the year. After a remarkable rally in April and May, the index has gradually crept higher in recent weeks.

"We've had the sharpest selloff in history from a record high to a bear market," said Phil Orlando, chief equity market strategist at Federated Hermes. "We followed that up with the sharpest rebound in history from a bear market to a new record high."

Stocks wavered between small gains and losses for much of Wednesday's session. They lost momentum after the Fed released minutes of its July meeting that showed officials grappled with how to spur growth amid low rates and rising virus cases.

They said the U.S. needed greater support recovering from the coronavirus pandemic but were hazy about when they should deploy their tools. Fed officials expressed limited enthusiasm for yield curve control, a policy that typically involves targeting rates and pledging to buy longer-term bonds.

"It was a mechanism for providing stimulus that the Fed has now ruled out at least for the time being," said Nathan Sheets, chief economist at PGIM Fixed Income. "They said we're really good with the hammer and screwdriver, but don't need the drill."

The yield on the benchmark 10-year Treasury note rose to 0.674% Wednesday, from 0.668% Tuesday.

A string of recent economic data has pointed to signs of a rebound in the American labor market, the manufacturing sector and consumer spending. But some investors remain nervous about the sustainability of a market rebound.

The U.S. death toll from the coronavirus pandemic passed 170,000 this week. The market is counting on additional stimulus spending by the government to bolster consumer confidence after a special jobless benefit for millions of Americans lapsed at the end of July. But talks between Republicans and Democrats remain stalled, Treasury Secretary Steven Mnuchin said Tuesday.

"There's a strange combination of things going on at the moment: There's some better economic data, proving to be a bit supportive of equities, but running alongside that are the fiscal risks in the U.S. and the weaker dollar," said Georgina Taylor, a multiasset fund manager at Invesco. "I don't think the moves in markets are very consistent."

The lead-up to the November presidential elections is expected to inject volatility in markets in the coming weeks. Former Vice President Joe Biden formally clinched the Democratic presidential nomination Tuesday night. A Biden win increases the odds of higher corporate taxes and regulation and would likely be a drag on the stock market. Some strategists believe a rally shows that investors are pricing in the status quo where President Trump remains in office.

Elevated stock prices have been frustrating for many value investors looking for bargain purchases, but they aren't completely staying away.

"It seems as if there's a lot of positivity and optimism that's reflected in the stock prices that makes it harder to find bargains," said Adam Schwartz, investment chief at Black Bear Value Partners. "That said, there are pockets of value in a variety of sectors -- if you're willing to do the work and dig in on stocks that are less popular." He said the firm added to its energy exposure Wednesday.

The recovery has been uneven. The biggest beneficiaries of the pandemic have included tech giants. They are poised to gain market share as e-commerce booms, and remote workers rely on videoconferencing, software and cloud computing more. Apple shares rose 58 cents, or 0.1%, to $462.83 and in intraday trading became the first U.S. public company to eclipse $2 trillion in market value.

In corporate news, Target shares rallied $17.32, or 13%, to $154.22, after it said comparable sales grew by a record 24% in the second quarter. Home improvement retailer Lowe's edged up 37 cents, or 0.2%, to $158.28 after it reported quarterly results that beat analysts' estimates.

Major stock benchmarks in China and Hong Kong slipped as trade tensions between the U.S. and China continued to ratchet up. The State Department urged U.S. university endowments to divest from China stocks on Tuesday, escalating a war of words against China.

The Shanghai Composite Index fell 1.2%, its biggest decline in more than three weeks. Hong Kong's Hang Seng Index retreated 0.7%.

Write to Anna Hirtenstein at anna.hirtenstein@wsj.com and Dawn Lim at dawn.lim@wsj.com