U.S. stocks eked out gains on Wednesday despite another rise in oil prices, as investors bet the latest signs of economic strength may be able to absorb expected higher energy costs.

Wall Street seesawed against the changes in oil throughout the day. Brent crude rose to a 2 1/2-year high above $117 a barrel in the late morning after bombing raids struck near Libya's oil terminals, but later slipped. Brent settled up 93 cents at $116.35.

The Dow Jones industrial average <.DJI> gained 8.63 points, or 0.07 percent, to 12,066.65. The Standard & Poor's 500 Index <.SPX> gained 2.10 points, or 0.16 percent, to 1,308.43. The Nasdaq Composite Index <.IXIC> gained 10.66 points, or 0.39 percent, to 2,748.07.

(Editing by Kenneth Barry)