NEW YORK — The stock market bounced back Friday, a day after suffering its second-worst loss this year. Bank stocks had some of the biggest gains even though many of them had their credit ratings cut the day before.
JPMorgan Chase, Bank of America and other big lenders posted solid gains. Banking analysts said the downgrades from Moody’s Investor Service late Thursday had been expected for months and removed uncertainty that had been weighing on banks.
‘‘It’s been like a cloud over the sector,’’ said Brian Gendreau, market strategist with the broker Cetera Financial. ‘‘And look at who’s going up: bank stocks. There are obviously some people who thought it would be much worse.’’
The Dow Jones industrial average gained 67.21 to close at 12,640.78. Bank of America gained 1.5 percent, or 12 cents, to $7.94, one of the best showings of the 30 stocks in the Dow.
In a note to clients, analysts at the investment bank Keefe Bruyette & Woods called Morgan Stanley ‘‘the clear winner.’’ Some analysts had expected Moody’s to lower Morgan Stanley’s rating by three notches, instead of the two-notch cut it received.
Bank stocks rose across the board. Morgan Stanley rose 18 cents to $14.14. JPMorgan Chase climbed 48 cents to $35.99.
The Standard & Poor’s 500 index rose 9.51 points to 1,335.02 and the Nasdaq composite index climbed 33.33 points to 2,892.42. The gains turned the Nasdaq positive for the week.
Information technology stocks had the strongest gains of the 10 industry groups tracked by the S&P 500 index, followed by health care stocks and banks. The gains were small but widespread. All 10 sectors rose. Of the 30 stocks in the Dow, just two fell.
The Dow and S&P 500 finished the week lower, their first week of losses since June 1. The biggest drop of the week came Thursday, when a trio of weak manufacturing reports stirred fears about the global economy. The Dow lost 251 points, its second-steepest fall this year. The worst was June 1, after a dismal U.S. jobs report rattled markets.
Even with two days of deep losses, the S&P 500 is still up 1.9 percent this month. To Gendreau, it looks like investors have been overreacting to recent economic reports. ‘‘The market is getting jerked around,’’ he said. ‘‘The economic data point to a softening economy, but we’ve had a softening economy for three years now.’’
Among other stocks making big moves:
— Facebook surged 3.8 percent, rising $1.21 to $33.05. A Nomura analyst started covering the social-networking company with a price target of $40 and a ‘‘buy’’ recommendation. Brian Nowak said Facebook could make more money through charging companies for pages. He also thinks the stock looks cheap in comparison to what investors paid for Google at the same age.
— Truck leasing company Ryder System plunged 13 percent, the worst decline in the S&P 500 index. The Miami-based company cut its earnings forecast for the second quarter and full year, blaming weak demand for commercial truck rentals and unusually high costs for medical benefits. The stock lost $5.31 to $35.44.
— The cruise ship operator Carnival Corp. dropped 2.7 percent after reporting a 92 percent plunge in quarterly profits, largely a result of losses on derivative fuel contracts. The company’s brands include the Costa line of cruise ships, whose Concordia capsized off the Italian coast in January. Carnival’s stock lost 92 cents to $33.66.