Stocks ended lower Tuesday, with a selloff by tech-related heavyweights sending the Nasdaq Composite to a sharp loss. Remarks by Treasury Secretary Janet Yellen, who said that interest rates may eventually need to rise to cool the economy, contributed to weakness, analysts said. The Dow Jones Industrial Average , however, erased losses to eke out a gain of around 22 points, or 0.1%, to close near 34,135, according to preliminary figures. The S&P 500 fell around 28 points, or 0.7%, to finish near 4,165. The Nasdaq Composite slumped around 262 points, or 1.9%, ending near 13,634. Apple Inc. shares were among hard-hit Big Tech shares, falling 3.5%, while Amazon.com Inc. fell more than 2% and shares of Google parent Alphabet Inc. , Netflix Inc. and Microsoft Corp. fell more than 1%.

Market Pulse Stories are Rapid-fire, short news bursts on stocks and markets as they move. Visit MarketWatch.com for more information on this news.