Stocks finished with big gains Wednesday as bank shares rose with interest rates and technology companies recovered some of their recent losses.

JPMorgan Chase (JPM) spiked 2 percent. Investors are betting that banks will make more money on lending as rates increase — and return more of it to shareholders after the Federal Reserve gave the green light Wednesday to all 34 of the biggest banks in the U.S. to raise their dividends and buy back shares, judging their financial foundations sturdy enough to withstand a major economic downturn.

It was the first time in seven years of annual “stress tests” that every bank assessed by the Fed won approval for its capital plans. Those allowed to raise dividends or repurchase shares include the four biggest U.S. banks — JPMorgan Chase, Bank of America, Citigroup and Wells Fargo.

Among tech companies, Apple (APPL) rose 1.5 percent and TripAdvisor jumped 4.5 percent. Energy companies rose as oil futures climbed for the fifth consecutive day.

Consumer-focused companies also jumped as stocks recovered the previous day’s losses. Staples jumped 8.5 percent on reports of a possible sale.

Medical device company Spectranetics surged 26 percent after Dutch electronics and health-care technology company Philips agreed to buy the company for $38.50 a share, or $1.68 billion.

The Standard & Poor’s 500 index made its biggest gain in two months. It advanced 21 points, or 0.9 percent, to 2,440.

The Dow Jones industrial average rose 143 points, or 0.7 percent, to 21,454. The Nasdaq composite added 87 points, or 1.4 percent, to 6,234.

Small-company stocks made larger gains and the Russell 2000 index soared 1.5 percent.