* Oil jumps, making energy sector lead S&P gainer
* IBM falls 7 pct after margins miss, drags on indexes
* CSX, UAL jump on strong reports, boost Dow Transports
* Dow down 0.16, S&P 500 up 0.08 pct, Nasdaq up 0.19 pct (Updates to close, adds commentary)
By Sinéad Carew
NEW YORK, April 18 (Reuters) - The S&P 500 eked out a small gain while the Dow declined after a volatile trading session on Wednesday, with weakness in sectors such as consumer staples and financials offsetting strong gains in the energy and industrial indexes.
Higher oil prices boosted energy stocks while transport stocks such as CSX Corp helped the industrial sector. But IBM's 7.5 percent drop was the biggest drag on the S&P after the technology company's quarterly profit margins missed Wall Street targets.
"There's a lot of headlines pulling the market in different directions. The most notable is energy prices pulling that sector higher," said David Joy, chief market strategist at Ameriprise in Boston.
Joy attributed a drop in financial stocks to a flattening yield curve in U.S. treasuries.
"Earnings and the yield curve are the two biggest influences," said Joy, adding that "transports are very strong today which is a very good sign for the economy."
No. 3 U.S. railroad operator CSX jumped 7.8 percent after topping profit estimates. Its news lifted other railroads, and helped to push the Dow Jones Transport index up 1.7 percent.
Also United Continental gained 4.8 percent and lifted other airline stocks after reporting a better-than-expected quarterly profit.
Trading was choppy, with the Dow swinging between positive and negative territory while the S&P 500 gave up most of its gains in the last few minutes of trading.
The Dow Jones Industrial Average fell 38.56 points, or 0.16 percent, to 24,748.07, the S&P 500 gained 2.25 points, or 0.08 percent, to 2,708.64 and the Nasdaq Composite added 14.14 points, or 0.19 percent, to 7,295.24.
In late afternoon trade the S&P briefly lost ground after a Federal Reserve report said robust business borrowing, rising consumer spending, and tight labor markets indicated the U.S. economy is on track for continued growth, with trade war risks being the one big outlier.
However, Mark Heppenstall, chief investment officer at Penn Mutual Asset Management in Horsham, Pennsylvania, said investors were hopeful for a positive outcome with China.
"China trade tensions seem to have moved to the back burner," he said. "Earnings are part of the equation as well. The bar was high. There was a risk expectations would outpace what comes through but generally earnings have been favorable."
Wall Street expects S&P 500 first-quarter earnings to grow 19.4 percent, according to Thomson Reuters data.
Oil futures settled up 2.9 percent due to a decline in U.S. crude inventories and after sources signaled top exporter Saudi Arabia wants to see crude prices closer to $100 a barrel. The S&P energy sector was up 1.6 percent.
The CBOE Volatility index ended up 0.35 point at 15.60, its first daily increase after six days of declines.
Lam Research fell 4 percent on analyst concerns about a slowdown in demand for its chip equipment.
The Philadelphia SE Semiconductor index finished down 1 percent.
Advancing issues outnumbered declining ones on the NYSE by a 1.26-to-1 ratio; on Nasdaq, a 1.09-to-1 ratio favored advancers.
The S&P 500 posted 39 new 52-week highs and two new lows; the Nasdaq Composite recorded 131 new highs and 36 new lows.
On U.S. exchanges 6.46 billion shares changed hands, compared to the almost 7 billion average for the last 20 days. (Additional reporting by Sruthi Shankar in Bengaluru; Editing by Bernadette Baum and James Dalgleish)