NEW YORK —U.S. stocks rose sharply Friday, lifting the Dow industrials and S&P 500 into positive terrain for the week, as bank shares rallied after JPMorgan Chase & Co.'s second-quarter results.

"They are the single best bank, not only domestically but globally," said Chip Cobb, portfolio manager at BMT Asset Management in Bryn Mawr, Pa., referring to JPMorgan.

The Dow Jones industrial average rose 203.82 points, or 1.6 percent, to 12,777.09. The index is up 0.04 percent from the July 6 close.

All but one of the Dow's 30 components rose Friday, led by JPMorgan Chase, up 6 percent after the nation's largest bank reported a $5 billion profit in the second quarter, which included a $5.8 billion trading loss on synthetic credit derivatives.

"Will they get this behind them? There is no doubt about it. But it is a black eye; they were viewed as above this," Cobb said of JPMorgan Chase's trading loss.

The sole blue-chip decliner, Hewlett-Packard Co. fell 1.9 percent after a JPMorgan analyst reiterated an underweight rating on shares of the maker of personal computers and printers.

Also erasing its weekly decline, the S&P 500 index climbed 22.01 points, or 1.7 percent, to 1,356.77, with finance companies pacing the gains that included all 10 of the index's sectors and left it up 0.2 percent from the July 6 finish.

Wells Fargo & Co. rallied 3.2 percent after reporting a 17 percent rise in profit. Phillips 66 advanced 5.9 percent after Warren Buffett said Berkshire Hathaway Inc. had invested in the refiner. The Nasdaq composite advanced 42.28 points, or 1.5 percent, to 2,908.47, off 1 percent for the week.

For every stock falling, five rose on the New York Stock Exchange, where nearly 683 million shares traded. Composite volume neared 3.2 billion.

Friday's rally — Wall Street's best session of the month — halted a six-session losing stretch for the Dow industrials and S&P 500, and a five-day down run for the Nasdaq.

Crude-oil futures added $1.02 to $87.10 a barrel, up 3.1 percent for the week. Gold futures rose 1.7 percent to close at $1,592 an ounce, with the metal up 1.7 percent from the week-ago close. The dollar fell against other currencies.