Last Updated Apr 20, 2016 3:18 PM EDT
Energy companies led U.S. stocks higher in afternoon trading Wednesday as the price of oil recovered from an early slide. Investors were also weighing the latest company earnings and deal news. Consumer staples companies lagged the rest of the market.
The Dow Jones industrial average rose 105 points, or 0.6 percent, to 18,159 as of 3:05 p.m. ET. The Standard & Poor's 500 index added nine points, or 0.4 percent, to 2,110. The Nasdaq composite index gained 28 points, or 0.6 percent, to 4,968.
After several weeks of moving in different directions, the stock market appears to be getting more closely tied to the fluctuations in oil prices.
"Oil is what's been driving the market lately," said Chris Gaffney, president of EverBank World Markets.
Climbing oil and natural gas prices helped lift shares in several energy companies.
Discover Financial Services climbed after the credit card issuer and lender reported better-than-anticipated quarterly profit and sales as loan volume improved.
VMWare jumped after the cloud-computing company reported better-than-expected earnings. Lexmark International surged after the printer maker agreed to be bought by a group that includes Apex Technology and PAG Asia Capital for about $2.51 billion.
Yahoo rose a day after the Internet pioneer said that it is considering the sale of part or all of its Internet business. The news overshadowed its latest quarterly loss.
Coca-Cola slid after the world's biggest beverage maker reported a lower profit for the first quarter. The company was squeezed by a strong dollar and charges related to the transformation of its North American operations.
Angie's List slid after the online ratings service reported an unexpected loss and disappointing sales in the first quarter.
U.S. crude reversed an early morning slide to settle at $42.63, up $1.55 or 3.77 percent.
In Europe, Germany's DAX rose 0.7 percent, while the CAC-40 of France gained 0.6 percent. The FTSE 100 of leading British shares added 0.1 percent. Earlier in Asia, most markets closed lower. South Korea's Kospi fell 0.3 percent and Hong Kong's Hang Seng slid 0.9 percent. Japan's benchmark Nikkei 225 edged up 0.2 percent, while Australia's S&P/ASX 200 added 0.5 percent.
Bond prices rose. The yield on the 10-year Treasury note fell to 1.81 from 1.78 late Tuesday. In currency markets, the euro fell to $1.1322 from $1.1377, while the dollar rose to 109.71 yen from 109.13.