By Anna Isaac and David Benoit

U.S. stocks gains slipped away Wednesday despite the Federal Reserve signaling it was ready to keep interest rates near zero for three more years and unpin the economy even in the face of inflation.

The S&P 500 fell 0.5% as of the 4 p.m. close of trading in New York, while the Dow Jones Industrial Average added 38 points, or 0.1%, staying relatively stable after the central bank's release. Both broad indexes were aiming for their fourth-straight session of gains.

The Nasdaq Composite Index slipped 1.3% as big tech stocks sold off. The indexes are all still down this month, with the Nasdaq off more than 6% in September.

In its last meeting before the November election, the Fed left rates unchanged, as widely expected, and said it now expects them to stay there through 2023. The committee's expectations for economic growth and unemployment in 2020 have grown sunnier since the last meeting. They now expect gross domestic product to fall 3.7% in 2020, compared with a 6.5% drop they forecast in June.

"Last time, they were very bearish compared to what the market had been expecting," Edward Park, deputy chief investment officer at Brooks Macdonald, had said before the release.

The meeting is the Fed's first since forging a new framework governing how to conduct policy over the long run. Investors have been eager for more guidance on how changes will work in practice, including from Chairman Jerome Powell's press conference, which starts at 2:30 p.m. The Fed said it would keep inflation above 2% "for some time" to achieve its goals.

In bond markets, the yield on the benchmark 10-year U.S. Treasury ticked down to 0.665%, from 0.678% Tuesday, little changed after the release.

Investors are also continuing to assess the prospects for additional government spending, with negotiations complicated by calculations surrounding the November elections. On Tuesday, House Speaker Nancy Pelosi said the chamber should remain in session until lawmakers can strike a bipartisan agreement on new coronavirus relief. White House adviser Jared Kushner said any deal could be a ways off.

Markets would likely cheer more government action, but have grown pessimistic on the odds.

JPMorgan strategists recently raised their S&P 500 target for this year to 3600, predicting another nearly 6% in gains. But that was based on stronger corporate earnings and economic data, as they have tempered their expectation for more stimulus.

"When I look at where the stimulus talks are, the odds of something getting done are very, very slim," Joyce Chang, the bank's head of research, said Wednesday. "Both sides are far apart."

Instead, Ms. Chang said, investors are turning their questions increasingly toward the U.S. elections and trying to plan for a drawn-out result.

Retail spending rose 0.6% in August for the fourth straight monthly increase, according to data from the Commerce Department, but at a slower pace than expected as some extra unemployment benefits ran out.

The energy sector helped lead the S&P 500 higher.

Brent crude, the international energy benchmark, rose 3.9% to $42.10 a barrel after data showing that U.S. crude inventories unexpectedly declined. Hurricane Sally, which churned through the Gulf of Mexico and slammed into Alabama as a Category 2 storm this morning, has curtailed offshore oil production and is likely to further hit U.S. supply.

In individual moves, shares of FedEx rose 5.7% as one of the best performers. The delivery company posted the highest quarterly revenue in its history as the coronavirus pandemic spurred residential-shipment levels normally seen during the holiday season.

The Dow Jones Transportation Average was headed for a record close, the first in two years.

Facebook shares slipped 2.6% after The Wall Street Journal reported that the Federal Trade Commission was gearing up to file a possible antitrust lawsuit against the company, in a case that would challenge the company's dominant position in social media. Other tech stocks were sliding as well, including Apple down 1.9%.

Still, two initial public offerings soared in their opening moments as investors continue to gobble up technology stocks. Snowflake, a cloud-based data management provider, opened at $245 a share after pricing at $120 in the biggest technology deal of the year.

The far smaller technology company JFrog opened about 60% higher than its IPO.

Overseas, the pan-continental Stoxx Europe 600 index rose 0.6%.

In Asia, major equity indexes ended the day on a mixed note. Japanese stocks edged higher thanks to gains in e-commerce and online-services stocks, sending the Nikkei 225 index up less than 0.1%. China's Shanghai Composite Index ticked down 0.4%.

Write to Anna Isaac at anna.isaac@wsj.com and David Benoit at david.benoit@wsj.com