U.S. stocks moved broadly higher in late-afternoon trading Friday, steering the S&P 500 and other major indexes hit all-time highs. Technology stocks, the best performing sector this year, accounted for much of the market’s climb. Materials companies also posted solid gains. Energy stocks rose as U.S. oil prices capped their best week in two months.

The rally followed remarks earlier in the day by Federal Reserve Chairman Jerome Powell, who struck a measured tone about the economy and said the Fed plans to stick with a gradual pace of rate hikes.

THE QUOTE: “The equity markets wanted to hear that slow-and-steady is the path, and I didn’t hear anything to the contrary,” said Rob Eschweiler, global investment specialist at J.P. Morgan Private Bank.

KEEPING SCORE: The S&P 500 rose 17 points, or 0.6 percent, to 2,874, beating the record it set in January by two points. The Dow gained 133 points, or 0.5 percent, to 25,790. The Nasdaq added 67 points, or 0.9 percent, to 7,945. The Russell 2000 index of smaller-company stocks picked up 6 points, or 0.4 percent, to 1,723. The indexes are all on track to finish the week with a gain.

FED TALK: Speaking at an annual conference of central bankers in Jackson Hole, Wyoming, Powell said he expects the Fed to gradually raise interest rates if the U.S. economic expansion remains strong. He explained that the central bank recognizes the need to strike a careful balance between its mandates of maximizing employment and keeping price increases stable. He said a gradual approach to rate hikes is the best way to navigate between the risks of raising rates too fast and “needlessly shortening the expansion” and moving too slowly and risking an overheated economy.

Powell added that while annual inflation has risen to near the Fed’s 2 percent target rate, it doesn’t seem likely to accelerate above that point. That suggests that Powell doesn’t foresee a need for the Fed to step up its rate hikes. Next month, the Fed is widely expected to resume raising rates.

“The markets are responding positively to Powell’s comments,” said Erik Davidson, chief investment officer at Wells Fargo Private Bank. “He didn’t express a lot of concern about inflation going out of control or the economy overheating.”

TECH ON A TEAR: Investors continued to bid up technology sector stocks. Video game publisher Activision Blizzard rose 3.4 percent to $73.59.

SOLID QUARTER: Software maker Autodesk surged 14.3 percent to $155.85 after issuing a better-than-expected quarterly report and strong forecasts.

MATERIALS RALLY: Shares in materials sector companies posted solid gains. Albemarle picked up 2.8 percent to $96.40.

TROUBLING TREND: Gap slumped 9.7 percent to $29.30 after the clothing chain said sales at Gap stores fell in the second quarter compared to a year earlier.

DISAPPOINTING OUTLOOK: Hibbett Sports sank 29.7 percent to $20.68 after the retailer cut its fiscal year profit and sales forecasts following a weak second quarter.

ENERGY: Benchmark U.S. crude gained 1.3 percent to settle at $68.72 per barrel in New York. It snapped a seven-week losing streak, finishing this week about 5 percent higher. Brent crude, used to price international oils, rose 1.5 percent to close at $75.82 per barrel.

The latest increase in oil prices helped boost energy stocks. Concho Resources gained 2.6 percent to $137.92.

BOND YIELDS: Bond prices were little changed. The yield on the 10-year Treasury held steady at 2.82 percent.

CURRENCIES: The dollar fell to 111.19 yen from 111.28 yen late Thursday. The euro strengthened to $1.1626 from $1.1536.

METALS: Gold rose 1.6 percent to $1,213.30 an ounce. Silver gained 1.7 percent to $14.79 an ounce. Copper climbed 1.7 percent to $2.72 a pound.

MARKETS OVERSEAS: In Europe, Germany’s DAX rose 0.2 percent, while the CAC 40 in France added 0.2 percent. The FTSE 100 index of leading British shares gained 0.2 percent. In Asia, Japan’s Nikkei 225 stock index closed 0.9 percent higher. The Kospi in South Korea rose 0.5 percent. Hong Kong’s Hang Seng lost 0.4 percent.

© The Associated Press. All rights reserved.