(AP) -- Stocks bounced back from a midday stumble and closed higher Thursday, keeping the major indexes on track for their first weekly gain in four weeks.
The S&P 500 closed 0.7% higher, after recovering from a 0.9% slide in the early going. The Dow Jones Industrial Average and the Nasdaq composite each gained 0.6% after making it through their own bumpy ride. The indexes are on pace for a weekly gain after posting losses for the previous three weeks.
Wall Street had its eye on interest rates, as the European Central Bank made its largest-ever rate increase to fight inflation. The move is in line with steps taken by the U.S. Federal Reserve and other central banks.
Investors also heard from Fed Chair Jerome Powell, who reaffirmed the central bank's commitment to keep rates high as long as necessary to get inflation under control.
Traders "were initially caught off-guard by how firm the Fed's position remains on fighting inflation," said Sam Stovall, chief investment strategist at CFRA. "But once investors realized that he wasn't really saying anything different than what he had said before, the markets swung back."
The S&P 500 rose 26.31 points to 4,006.18. It's up 2.1% so far this week.
The Dow swung from a 259-point loss to a gain of 193.24 points, closing at 31,744.52. The Nasdaq gained 70.23 points to 11,862.13.
Smaller company stocks also gained ground after an initial pullback. The Russell 2000 rose 14.90 points, or 0.8%, to 1,846.91.
Stocks have been mostly losing ground in recent weeks after the Federal Reserve indicated it will not let up anytime soon on raising interest rates to bring down the highest inflation in decades. The interest rate policies of the Fed and other central banks, which also have a powerful influence on stock and bond markets, have become a major focus for investors.
On the same day the European Central Bank delivered its big rate increase, Powell told a conference on monetary policy hosted by the Cato Institute, a think tank that promotes libertarian ideas, that the Fed would keep rates high "until the job is done" in getting inflation back down to its 2% goal.
"There is a record of failed attempts to get inflation under control, which only raises the ultimate costs to society," Powell said.
The Fed has already raised rates four times this year and markets expect it to deliver another jumbo-sized increase of three-quarters of a percentage point at its next meeting in two weeks.
Powell "sounded very resolute in the (Fed's) mission to squelch inflation, and as a result probably gave more credence to the possibility of a 75-basis point hike at the September meeting," Stovall said.
One of the Fed's biggest fears is that households and businesses begin to expect inflation to stay high in the long term, which could lead them to start buying in a way that creates a vicious cycle making inflation even harder to shake.
The Fed has caught criticism for not taking inflation seriously sooner, and Powell said that setting interest-rate policy is an art as much of a science. A big question remains about whether the high inflation ravaging economies around the world is a one-off created by the pandemic or the start of something more persistent.
Bond yields rose broadly as traders weighed Powell's remarks and the ECB's rate hike. The two-year Treasury yield, which tends to track expectations for Fed action, rose to 3.52% from 3.44%. The yield on the 10-year Treasury, which influences interest rates on mortgages and other loans, rose to 3.32% from 3.27% late Tuesday.
Health care stocks accounted for a big share of the S&P 500's gains. Regeneron Pharmaceuticals surged 18.8% after the company and partner Bayer reported encouraging study data on an anti-blindness drug.