(AP) -- Banks and other financial companies led U.S. stocks slightly higher Wednesday, snapping a two-day losing streak for the market.
The latest gains were partially offset by a slide in energy companies following a steep slump in the price of U.S. crude oil, which fell 5.1 percent, its biggest single-day drop in nearly three months.
Trading was mostly subdued, with the major indexes trading in a narrow range as investors sized up the latest company earnings and looked ahead to testimony Thursday from former FBI Director James Comey, part of a congressional investigation into Russia's possible election meddling.
"From an investor perspective it would be nice to get another potential distraction out of the way and move toward the threefold mandate of the Trump administration: deregulation, reduced taxes and improved infrastructure, because they have been delayed, delayed and delayed," said Erik Davidson, chief investment officer for Wells Fargo Private Bank.
The Standard & Poor's 500 index rose 3.81 points, or 0.2 percent, to 2,433.14. The Dow Jones industrial average gained 37.46 points, or 0.2 percent, to 21,173.69. The Nasdaq composite index added 22.32 points, or 0.4 percent, to 6,297.38. The Russell 2000 index of small-company stocks picked up 1.78 points, or 0.1 percent, to 1,396.67.
The major indexes remain slightly below record highs set late last week.
Stocks wavered between small gains and losses early Wednesday as investors weighed the latest company earnings reports.
Comey's appearance before the Senate intelligence committee will be his first public comments since he was abruptly ousted by President Donald Trump on May 9. The former director's associates say Trump asked Comey if he could back off an investigation into Michael Flynn, who was fired as national security adviser because he misled the White House about his ties to Russia.
Investors will try to glean how the outcome of the hearing may play into the administration's efforts to forge ahead with Trump's pledge to cut taxes, increase infrastructure spending and implement other business-friendly policies.
Financials were the biggest gainers in the S&P 500, rising 0.8 percent. The sector is up 23 percent this year.
Speculation that the Federal Reserve may raise its key interest rate at a meeting of policymakers next week likely helped lift the sector on Wednesday, said Davidson. Higher interest rates allow banks and credit card issuers to charge more for loans, which boosts profits.
JPMorgan Chase gained 95 cents, or 1.2 percent, to $83.91. American Express rose $96 cents, or 1.2 percent, to $79.81.
Oil futures fell sharply after a report showed that U.S. crude stockpiles grew 3.3 million barrels last week. Experts had expected stockpiles to shrink by 3.5 million barrels. Benchmark U.S. crude slid $2.47, or 5.1 percent, to close at $45.72 per barrel in New York. Brent crude, used to price international oils, fell $2.06, or 4.1 percent, to settle at $48.06 per barrel in London.
The steep slide in oil prices sent several oil and gas drilling companies lower. Newfield Exploration was the biggest decliner in the S&P 500, losing $2.16, or 7 percent, to $28.90. Helmerich & Payne fell $3.22, or 6 percent, to $50.08. Rig operator Transocean gave up 51 cents, or 5.6 percent, to $8.59.
Investors also kept an eye on company earnings Wednesday.
Carvana jumped 32.8 percent after the online used car seller posted its first quarterly results as a public company and issued a forecast that exceeded Wall Street's expectations. The stock climbed $3.13 to $12.66.
Duluth Holdings slumped 18.6 percent after the clothing and tools supplier reported disappointing earnings. The stock slid $3.82 to $16.75.
Video compression chip maker Ambarella sank 10.2 percent after its guidance on sales of vision chips used by drones stoked concern among investors. The stock gave up $6.12 to $53.60.
Bond prices fell. The 10-year Treasury yield rose to 2.18 percent from 2.15 percent late Tuesday.
The dollar rose to 109.83 yen from Tuesday's 109.54 yen. The euro weakened to $1.1252 from $1.1271.
Among metals, gold slipped $4.30 to $1,293.20 per ounce. Silver lost 9 cents to $17.62 per ounce. Copper held steady at $2.55 per pound.
In other energy futures trading, wholesale gasoline shed 6 cents, or 4.1 percent, to $1.49 per gallon. Heating oil gave up 5 cents, or 3.4 percent, to $1.42 per gallon. Natural gas dipped 2 cents to $3.02 per 1,000 cubic feet.
In Europe, London's FTSE 100 slid 0.6 percent ahead of Thursday's British elections. Traders were also looking ahead to a policy meeting of the European Central Bank on Thursday. Germany's DAX slipped 0.1 percent, while France's CAC 40 fell 0.1 percent. In Asia, Tokyo's Nikkei 225 and Sydney's S&P-ASX 200 were unchanged. Hong Kong's Hang Seng fell 0.2 percent. Seoul's Kospi shed 0.4 percent.