US stocks have ended flat after gains brought by a sign of improvement in the labor market were erased in part by a drop in Apple shares after a legal setback in a court ruling.

Apple fell 2 per cent to $US628.10 after a US appeals court overturned a preliminary injunction on the sale of Samsung’s Galaxy Nexus smartphone, dealing a blow to the iPhone maker in a battle against Google’s Android mobile software.

Traders have been bearish recently, with the S&P 500 down 2 per cent in the last five sessions in anticipation of a weak earnings season. News that the number of Americans filing new claims for jobless benefits fell to its lowest level in more than four-and-a-half years gave the market only marginal support.

‘‘Unless we get blowout numbers in the earnings season, this sort of volatile environment will likely continue in the near term,’’ said Robert Pavlik, chief market strategist at New York-based Banyan Partners.

AT&T and Verizon also weighed after news that Japan’s Softbank may buy a majority stake in their competitor, Sprint Nextel. Sprint shares rallied more than 13 per cent but AT&T and Verizon lost more than 1 per cent each on expectations of harsher market competition.

The S&P 500 is just over 8 per cent below its record closing high, set five years ago, and the corporate results season that started this week is expected to show the first drop in year-on-year quarterly earnings since 2009.

‘‘We’re so close to all-time highs, and there’s so much talk of fundamentally having no reason to be here, that people are taking profits,’’ said Doreen Mogavero, CEO of Mogavero, Lee & Co in New York.

The Dow Jones industrial average fell 18.58 points, or 0.14 per cent, to 13,326.39. The S&P 500 edged up 0.28 point, or 0.02 per cent, to 1,432.84. The Nasdaq Composite dipped 2.37 points, or 0.08 per cent, to 3,049.41.

Energy stocks led gains in the main 10 S&P 500 sectors with a 0.6 per cent advance. Coal miner Peabody Energy rose 8.9 per cent to $US26.18 and its peer Consol Energy added 8 per cent to $US35.48 on bets higher natural gas prices would encourage coal use by power producers.

Sprint shares jumped 14.3 per cent to $US5.76 on news of the possible acquisition by Japan’s Softbank, while AT&T lost 1.8 per cent to $US36.26 and Verizon dropped 1.3 per cent to $US45.20.

Clearwire Corp, in which Sprint holds a majority interest, surged 70.8 per cent to $US2.22.

Truck manufacturer Oshkosh rallied 11.4 per cent to $US29.90 on news that investor Carl Icahn had offered to buy all of its shares for $US32.50 each. OshKosh advised shareholders to take no action until further notice Dollar Tree, off 7.7 per cent to $US43.28, led per centage declines among discretionary sector stocks after it said it will post third-quarter sales at the lower end of its earlier forecast. The S&P retail sector index fell 0.9 per cent.

About 6.1 billion shares changed hands on the New York Stock Exchange, the Nasdaq and NYSE MKT, slightly below the daily average so far this year of about 6.52 billion shares.

On the NYSE, almost two issues rose for every one that fell and on the Nasdaq three issues rose for every two that posted declines.

Reuters