NEW YORK - Soothing words from Federal Reserve Chair Janet Yellen helped pull the stock market out of a morning slump Wednesday. But Internet companies and Whole Foods Market plunged, taking the Nasdaq down.

Traders dropped NetApp,, and other tech companies for a second day running, sending their stocks down 2 percent or more. Whole Foods sank 19 percent after cutting its profit forecast.

Yellen told the Joint Economic Committee of Congress that a tough job market and weak inflation meant that the Fed will likely keep borrowing rates low for a "considerable time." She said the economy still needed the Fed's help.

Yellen's comments appeared to ease concerns that the Fed was going to remove more support. The stock market had wandered lower in morning trading, then turned from a loss to a gain before the lunch hour.

The Standard & Poor's 500 index gained 10.49 points, or 0.56 percent, to close at 1,878.21. The Dow Jones industrial average climbed 117.52 points, or 0.72 percent, to 16,518.54. The Nasdaq gave up 13.09 points, or 0.32 percent, to 4,067.67.

The S&P 500 is within striking distance of its all-time closing high of 1,890, reached on April 2.

"Whenever you're near all-time highs you're going to see skittishness," said JJ Kinahan, chief strategist at TD Ameritrade. "In this market, the slightest news can change everything,"

Whole Foods cut its profit outlook late Tuesday, saying it is facing increased competition as supermarkets, big-box stores, and online retailers step up their offerings of organic foods. It's the third time the grocery chain has reduced its profit forecast in the last six months. Whole Foods dropped $9.02, or 19 percent, to $38.93.

Among Internet stocks, NetApp, a data management and storage company, fell $1.28, or 4 percent, to $33.70 and lost $1.35, or 3 percent, to $50.43.

Just two of the eight sectors in the S&P 500 fell, information technology and consumer discretionary companies. Gainers included utilities, which rose the most, 1.6 percent. Utilities are by far the best-performing sector in the market so far this year, up 13.8 percent.

In other markets, crude oil rose $1.27 to settle at $100.77 a barrel. Gold dropped $19.70 to $1,288.90 an ounce. U.S. government bonds barely moved. The yield on the 10-year Treasury note ended the trading day at 2.59 percent, unchanged from late Tuesday.

Among companies making big moves, Electronic Arts jumped $5.90, or 21 percent, to $33.95 after the video-game maker turned in stronger results late Tuesday. The maker of The Sims and Madden NFL reported higher profits and revenue than expected, and forecast stronger earnings over the next year. Electronic Arts has soared 45 percent so far this year.