Wall Street capped several days of choppy trading on Friday with a broad rally that gave the stock market a modest gain for the week.

Technology companies, banks and health care stocks accounted for much of the market’s gains. Energy companies also rose along with crude oil prices.

The rally came as bond yields pulled back for the second day in a row after reaching four-year highs earlier in the week. The spike on Wednesday, which sent the 10-year Treasury yield closing in on 3%, sent stocks sharply lower.

“There was a lot of concern about what happened if bond yields got above 3%, and that probably added to some of the jitters earlier this week,” said Willie Delwiche, investment strategist at Baird.

“Now you have a day when yields are moving away from that. At least for now, that probably lets equity traders breathe a sigh of relief and pushes stocks up a little.”

The Standard & Poor’s 500 index climbed 43.34 points, or 1.6%, to 2,747.30.

The Dow Jones industrial average picked up 347.51 points, or 1.4%, to 25,309.99.

The Nasdaq composite gained 127.30 points, or 1.8%, to 7,337.39. The Russell 2000 index of smaller-company stocks rose 19.20 points, or 1.3%, to 1,549.19.

The S&P 500, a key barometer for the stock market, had been on course to finish the week lower after losses on Tuesday snapped a six-day winning streak.

All told, the S&P 500 eked out a 0.6% gain for the week. The Dow and Nasdaq finished with gains of 0.4% and 1.4%, respectively.

Bond prices rose but the yield on the 10-year Treasury note fell to 2.87% from 2.92%.

The yield declined for the second day in a row after climbing as high as 2.95% on Wednesday, the highest level since January 2014.

That spike came after the Federal Reserve’s minutes from its January policy meeting showed bullish sentiment among policymakers, confirming their intention to raise interest rates this year.

Earlier this month, global stock markets, particularly those in the US, suffered big losses amid mounting concerns over the pace of inflation and Fed policy tightening.

“We’re at the mercy of people’s changing opinions day-to-day on inflation and the Fed, but over the long run, we would expect the market to emerge higher,” said Craig Callahan, president of ICON Advisers.