NEW YORK — Large technology and health care companies and smaller U.S.-focused firms rose again Friday as stocks finished the third quarter at record highs.

The market ended the quarter on a four-day winning streak that began after Federal Reserve Chair Janet Yellen said the central bank plans to continue raising interest rates.

“It’s all about the confidence they have that despite low inflation, it still makes sense to raise interest rates,” said Randy Frederick, vice president of trading and derivatives at the Schwab Center for Financial Research.

The Standard & Poor’s 500 index rose 9.30 points, or 0.4 percent, to 2,519.36. The Dow Jones industrial average turned higher to finish with a gain of 23.89 points, or 0.1 percent, at 22,405.09. The Nasdaq composite jumped 42.51 points, or 0.7 percent, to 6,495.96. The S&P 500 and Nasdaq both closed at all-time highs.

Tyson Foods climbed $5, or 7.6 percent, to $70.45. The stock gained more ground Friday than it had for the rest of this year put together.

Technology companies rose further and were the best-performing S&P 500 sector in the third quarter. They also held that distinction in the first quarter. The S&P 500 technology index has climbed 26 percent in 2017, while the S&P 500 is up 12.5 percent.

Facebook added $2.14, or 1.3 percent, to $170.87 and chip equipment maker Applied Materials rose $1.47, or 2.9 percent, to $52.09. Chipmaker Nvidia advanced $3.09, or 1.8 percent, to $178.77.

Stocks have risen for eight quarters in a row, and Frederick, of the Schwab Center, said he expects that to continue in the fourth quarter as the global economy is likely to keep growing and interest rates in the U.S. should rise more, which will help profits for banks.