Wall Street capped several days of choppy trading 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. That spike on Wednesday, which sent the 10-year Treasury yield closing in on 3 percent, sent stocks sharply lower.
"There was a lot of concern about what happened if bond yields got above 3 percent, 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 percent, to 2,747.30. The Dow Jones industrial average picked up 347.51 points, or 1.4 percent, to 25,309.99. The Nasdaq composite gained 127.30 points, or 1.8 percent, to 7,337.39. The Russell 2000 index of smaller-company stocks rose 19.20 points, or 1.3 percent, 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 percent gain for the week. The Dow and Nasdaq finished with gains of 0.4 percent and 1.4 percent, respectively.
Bond prices rose. The yield on the 10-year Treasury note fell to 2.87 percent from 2.92 percent. The yield declined for the second day in a row after climbing as high as 2.95 percent 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 U.S., 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.
Hewlett Packard Enterprise led the gainers among technology stocks Friday.
The data center hardware company surged 10.5 percent after it reported a strong fiscal first quarter and raised its estimates for the rest of the year. It also said it would increase its quarterly dividend. The stock climbed $1.73 to $18.14.
Its former corporate sibling, printer and PC maker HP, also rose. The stock gained 74 cents, or 3.5 percent, to $22.13 after HP's first-quarter earnings and revenue surpassed analyst expectations. Its forecasts for the rest of the year were also better than excepted.
Banks and other financials companies also posted solid gains. Capital One Financial was among the big gainers, adding $2.37, or 2.5 percent, to $99.04.
Vertex Pharmaceuticals led the health care sector's winners. The stock climbed $8.31, or 5.3 percent, to $165.90.
Blue Buffalo Pet Products soared after packaged goods company General Mills agreed to buy it for $40 a share, or $8 billion. Blue Buffalo jumped $5.88, or 17.2 percent, to $40. General Mills lost $1.97, or 3.6 percent, to $52.98.
Benchmark U.S. crude picked up 78 cents, or 1.2 percent, to settle at $63.55 a barrel in New York. Brent crude, used to price international oils, gained 92 cents, or 1.4 percent, to close at $67.31 a barrel in London.
The pickup in oil prices helped lift energy sector stocks. Newfield Exploration led the pack, climbing $1.20, or 5.1 percent, to $24.66.
In other energy futures trading, heating oil gained 2 cents to $1.97 a gallon. Wholesale gasoline added 4 cents to $1.81 a gallon. Natural gas was little changed at $2.63 per 1,000 cubic feet.
The dollar rose to 106.75 yen from 106.64 yen. The euro dipped to $1.2295 from $1.2329.
Gold fell $2.40 to $1,330.30 an ounce. Silver dropped 10 cents to $16.48 an ounce. Copper slid 3 cents to $3.21 a pound.
Major stock indexes in Europe closed mostly higher Friday. Germany's DAX index rose 0.2 percent, while France's CAC 40 gained 0.2 percent. London's FTSE 100 slid 0.1 percent. In Asia, Tokyo's Nikkei 225 gained 0.7 percent, Hong Kong's Hang Seng added 1 percent and Seoul's Kospi rose 1.5 percent.