NEW YORK (AP) -- Stocks shook off a midday slump and ended higher Thursday, keeping the market on track for its first weekly gain after three weeks of punishing losses.
Trading was wobbly throughout the day as investors remained focused on another round of testimony before Congress by Federal Reserve Chair Jerome Powell. Speaking before a House committee, Powell again stressed that the Fed hopes to rein in the worst inflation in four decades without knocking the economy into a recession, but acknowledged "that path has gotten more and more challenging."
The S&P 500 ended 1% higher after having been down as much as 0.4%. The Dow Jones Industrial Average rose 0.6% and the Nasdaq gained 1.6%.
Technology and health care stocks drove much of the rally, outweighing losses in energy and financial companies. Bond yields mostly fell. Oil prices also fell.
Trading has been turbulent in recent weeks as investors try to determine whether a recession is looming. The benchmark S&P 500 is currently in a bear market. That means it has dropped more than 20% from its most recent high, which was in January. The index has fallen for 10 of the last 11 weeks.
"The market was poised for a bounce," said Quincy Krosby, chief equity strategist for LPL Financial. "The catalyst for today's market has been that oil prices have come down."
The S&P 500 rose 35.84 points to 3,795.73. The index is up 3.3% so far this week. The Dow gained 194.23 points to 30,677.36. The Nasdaq added 179.11 points to 11,232.19.
Smaller company stocks also gained ground. The Russell 2000 rose 21.40 points, or 1.3%, to 1,711.67.
The Federal Reserve is attempting to temper inflation's impact with higher interest rates, but Wall Street is worried that it could go too far in slowing economic growth and actually bring on a recession.
Powell has previously acknowledged that a recession is "certainly a possibility" and that the central bank is facing a more challenging task amid the war in Ukraine essentially pushing oil and other commodity prices even higher and making inflation even more pervasive.
On Thursday, Powell stressed: "I don't think that a recession is inevitable." He also acknowledged that the Fed's tools to combat inflation are blunt and risk causing damage to the economy.
Encouragingly for the Fed, many households and businesses still seem to expect inflation to eventually come back down. If that were to change, it could spark a self-fulfilling vicious cycle that only worsens inflation.
"Our whole framework is about keeping inflation expectations well and truly anchored," he said Thursday. Powell emphasized the importance of getting inflation down to the Fed's goal of 2%. "We can't fail on this," he said.
Powell spoke to Congress a week after the Fed raised its benchmark interest rate by three quarters of a percentage point, its biggest hike in nearly three decades. Fed policymakers also forecast a more accelerated pace of rate hikes this year and next than they had predicted three months ago, with its key rate to reach 3.8% by the end of 2023. That would be its highest level in 15 years.
Earlier Thursday the Labor Department said fewer Americans applied for jobless benefits last week, though it was slightly more than economists expected. The solid job market is a relatively bright point in an otherwise weakening economy, with consumer sentiment and retail sales showing increasing damage from inflation.
Companies are signaling slower-than-expected growth, however, according to surveys from IHS Markit. While weak economic data is discouraging for the broader economy, it could also mean that the economy is already slowing enough to allow the Fed to ease up on its planned rate hikes.
Inflation remains stubbornly high, squeezing consumers with higher prices on everything from food to clothing. That has pressured people to shift spending from big ticket items like electronics to necessities. The pressure has been worsened by record-high gasoline prices that show no sign of abating amid a supply and demand disconnect.
Big technology and health care companies did much of the heavy lifting. Microsoft rose 2.3% and Johnson & Johnson rose 2.2%. Energy stocks fell as the price of U.S. crude oil dropped 1.8%. Valero fell 7.6%.
Bond yields fell significantly. The yield on the 10-year Treasury note, which helps set mortgage rates, fell to 3.09% from 3.15% late Wednesday.