The U.S. stock market notched its biggest gain in two months Wednesday, bouncing back from losses a day earlier.

Banks and other financial companies led the rally as investors bet on interest rates climbing further. Banks can make more money on lending when rates move higher.

Technology companies were among the big gainers, recouping some of their recent losses. Energy stocks also rose as the price of crude oil closed higher for the fifth straight day. Utilities and real estate companies were the only laggards.

“Across the board, sector strength is very, very strong,” said Marc Chaikin, CEO of Chaikin Analytics. “Whoever wanted to sell into the holiday weekend basically did it yesterday and we probably have a positive bias going into the four-day weekend.”

The Standard & Poor’s 500 index gained 21.31 points, or 0.9 percent, to 2,440.69. That’s the index’s biggest single-day gain since April 24. The Dow Jones industrial average added 143.95 points, or 0.7 percent, to 21,454.61. The Nasdaq composite rose 87.79 points, or 1.4 percent, to 6,234.41.

Smaller companies fared better than the rest of the market. The Russell 2000 index of small-company stocks picked up 21.75 points, or 1.6 percent, to 1,425.27.

Bond prices fell. The 10-year Treasury yield rose to 2.22 percent from 2.21 percent late Tuesday.

The market rebounded from Tuesday’s technology-led sell-off. The major indexes moved higher as trading got underway Wednesday and carried the momentum the rest of the day.

“These equity markets are perhaps in more of a relief rally, with investors coming back in after being away a bit here,” said Chris Gaffney, president of World Markets at EverBank. “It’s is the end of the quarter, so we’ll probably see more volatility going into the end.”

Traders bid up shares in financial sector companies amid heightened expectations that interest rates could be headed higher. Rising rates let banks make bigger profits on mortgages and other types of loans.

“Global rates are going to move higher and that, of course, helps financials across the board,” Gaffney said.

Bank of America added 61 cents, or 2.6 percent, to $23.88, while Prudential Financial rose $2.66, or 2.5 percent, to $107.26. Wells Fargo gained $1.17, or 2.2 percent, to $54.33.

Investors also bid up shares in companies that reported improved quarterly results.

Homebuilder KB Home climbed $1.24, or 5.4 percent, to $24.06, while wireless communications company CalAmp gained $1.19, or 6.2 percent, to $20.44. General Mills, the maker of Cheerios cereal, Yoplait yogurt and other packaged foods, added 90 cents, or 1.6 percent, to $56.42.

News of corporate deals also helped lift the market.

Staples climbed 8.5 percent after the Wall Street Journal reported that the office supplies retailer has agreed to be acquired by private equity firm Sycamore Partners. The stock was the biggest gainer in the S&P 500 index, rising 78 cents to $9.94.

Spectranetics surged 26.2 percent after Dutch electronics and health care technology company Philips said it agreed to buy the medical device company for $38.50 a share, or $2.2 billion. Spectranetics gained $7.95 to $38.35.

FedEx shares temporarily halted trading before the package delivery giant disclosed that an information system virus significantly affected the global operations of its TNT Express subsidiary.

In a statement, FedEx said that while TNT’s operations and communications systems were disrupted, “no data breach is known to have occurred.” The company noted that operations of all other FedEx companies were unaffected. The stock rose $2.82, or 1.3 percent, to $217.15.

Oil and natural gas futures notched gains Wednesday.

Benchmark U.S. crude added 50 cents, or 1.1 percent, to $44.74 a barrel in New York. Brent crude, the international standard, rose 66 cents, or 1.4 percent, to $47.31 per barrel in London. Wholesale gasoline rose 2 cents to $1.48 per gallon. Heating oil also added 2 cents to $1.43 per gallon. Natural gas gained 3 cents to $3.07 per 1,000 cubic feet.

In other commodities trading, gold rose $2.20 to settle at $1,249.10 per ounce. Silver added 14 cents to $16.73 per ounce. Copper gained 1 cent to $2.66 per pound.

The dollar rose to 112.28 from 112.15 yen late Monday. The euro strengthened to $1.1382 from $1.1347.

Major stock indexes in Europe declined as investors fretted over the prospect of tighter monetary policy from major central banks.

Germany’s DAX slid 0.2 percent, while the CAC 40 of France fell 0.1 percent. Britain’s FTSE 100 lost 0.6 percent.

Earlier in Asia, Hong Kong’s Hang Seng fell 0.6 percent, while Japan’s benchmark Nikkei 225 index lost 0.5 percent. South Korea’s Kospi shed 0.4 percent. Australia’s S&P/ASX 200 gained 0.7 percent. Shares fell in Taiwan and most of Southeast Asia.