Stocks edged higher on Wednesday as a rise in mining and energy shares offset worries about unrest in the Middle East and North Africa, while analysts saw more gains in oil ahead.

Volume was at about 4.5 billion, below average for afternoon trading, after the market posted the worst trading volume of the year on Tuesday.

The S&P index of materials stocks <.GSPM> rose 1.1 percent and was the S&P 500's top-performing sector. The sector climbed in sync with metals prices, including copper, which was up more than 2 percent. Freeport-McMoRan Copper & Gold shares shot up 4.3 percent to $54.53.

Speaking at a Reuters summit in New York, Freeport-McMoRan Chief Executive Richard Adkerson said the company has the balance sheet to handle a large acquisition.

Brent crude was trading around $115 a barrel as further unrest in Yemen added to risks of oil supply disruptions in the region.

Analysts said oil prices could stay high in the near term, improving the outlook for energy companies, but at the same time causing concern about the dampening effect of high energy costs for consumers.

The area at this point looks volatile, so oil prices are going to remain elevated and drift higher, said Fred Dickson, chief market strategist at D.A. Davidson & Co. in Lake Oswego, Oregon.

The big energy stocks are participating in the move with crude, but the surprise is refiner stocks have benefited, which means producers and refiners are passing through price increases fairly quickly, he said.

Refiner Valero Energy shot up 2.6 percent to $28.83. For the year, Valero's stock is up 25 percent.

Shares of Exxon Mobil , down 0.4 percent at $82.27 on Wednesday, have gained 13 percent since the start of the year.

The Dow Jones industrial average <.DJI> was up 45.37 points, or 0.38 percent, at 12,064.00. The Standard & Poor's 500 Index <.SPX> inched up just 0.79 of a point, or 0.06 percent, to 1,294.56. The Nasdaq Composite Index <.IXIC> was up 5.06 points, or 0.19 percent, at 2,688.92.

The Federal Reserve's rejection of a dividend plan by Bank of America weighed on bank stocks.

Bank of America Corp shares slid 1.9 percent to $13.62. The KBW index of bank stocks <.BKX> fell 0.8 percent.

In data that suggested the housing market's problems were continuing, U.S. new home sales fell in February to a record low and prices were the lowest since December 2003.

Other recent economic data, however, has suggested improvement in the economy, which has tempered some of the worries about rising oil prices, overseas tensions and Japan's disaster.

We're in a bit of a correction right now ... until the price of oil settles, said Peter Cardillo, chief market economist at Avalon Partners, in New York. But the bias will be to the upside for the market.

Money manager Van Eck Global resumed creating new shares of its Market Vectors Egypt Index Exchange Traded Fund after the local Egyptian market reopened. The fund was down 8.7 percent at $15.20, following losses in the Egyptian market.

(Reporting by Caroline Valetkevitch; Editing by Jan Paschal)