Stocks rose on Thursday as Apple and Micron surged to lead the tech sector higher. Investor sentiment was also boosted by the Federal Reserve's updated outlook on interest-rate hikes.

The Dow Jones Industrial Average closed 216.84 points higher at 25,962.51 as a 3.7 percent gain in Apple offset a decline of 1.6 percent in J.P. Morgan Chase. The closed 1.1 percent higher at 2,854.88 while the Nasdaq Composite outperformed, rising 1.4 percent to 7,838.96.

Apple rose after Needham upgraded the stock to strong buy from buy, citing "value upside" in the firm's ecosystem. Thursday's gains led the stock to break above its 200-day moving average for the first time since November.

Micron shares jumped 9.6 percent after reporting quarterly earnings that beat analyst expectations. Those gains lifted the VanEck Vectors Semiconductor ETF (SMH) by 3.5 percent.

"There's been a lot of buying in the tech sector after some good news," said Ilya Feygin, senior strategist at WallachBeth Capital. "Tech has definitely been the leader. There's been a lot of strength coming from there; I think a lot of that is deployment of cash."

Equities also got a lift as investors largely cheered the latest policy announcement from the Fed.

On Wednesday, the Fed said it does not expect to raise rates at all in 2019. The central bank had forecast at least two rate hikes for this year back in December. The Fed added it expects to end its balance-sheet reduction process by the end of September.

Treasury yields fell sharply on Wednesday, with the benchmark 10-year rate hitting its lowest level in a year. The yield traded at 2.53 percent on Thursday while the short-term 2-year rate held at 2.41 percent. Yields move inversely to prices.

"Some people assume, rightly or wrongly, that if the Fed is assuring low rates for the foreseeable future, then that is going to force everything else to trade richer from a valuation basis," WallachBeth's Feygin said. "That caused some inflows today."

However, it also lowered its economic growth forecast for 2019, raising concern over a possible slowdown in the economy.