New York - United States stocks ended slightly higher in a volatile half-day session on Wednesday as traders squared positions before the holiday and Friday's job market data.

The three major US stock indexes seesawed on thin trading volume, with some market participants already away before Thursday's Independence Day holiday. The US stock market closed at 1pm (17h00 GMT) on Wednesday. It will re-open on Friday for a full session.

Mixed US data on Wednesday failed to give the market solid direction. Private-sector employers stepped up hiring in June and weekly jobless claims fell, but the growth rate in the services sector slowed in June and the US trade deficit widened on a drop in exports.

“The only explanation that there is to the volatility is that the volume's really light, so any sudden moves in sentiment, whether it's buy or sell, reflects itself in the volatility because there's not a lot of liquidity,” said Jason Weisberg, managing director at Seaport Securities in New York.

About 3.37 billion shares exchanged hands on the New York Stock Exchange, the Nasdaq and NYSE MKT. The full trading-day average volume has been about 6.4 billion so far this year.

“There's position squaring ahead of the holiday and in front of (the payrolls report) Friday,” said Paul Mendelsohn, chief investment strategist at Windham Financial Services in Charlotte, Vermont.

Nonfarm payrolls for June are expected to have gained 165 000 last month, according to a Reuters survey of economists.

Equities in Europe and Asia were pressured by signs of slowing growth in China and deepening political turmoil in Portugal, where talks over the government's future threatened to reignite the euro-zone crisis.

The Dow Jones industrial average rose 56.14 points or 0.38 percent, to end at 14,988.55. The S&P 500 gained 1.33 points or 0.08 percent, to finish at 1,615.41. The Nasdaq Composite added 10.27 points or 0.30 percent, to close at 3,443.67.

The S&P 500 is down 3.2 percent from its May 21 record closing high of 1,669.16. The benchmark index has been unable to close above its 50-day moving average since June 20.

Large-cap tech stocks were among the strongest of the day, helping the Nasdaq. Cisco Systems rose 1.1 percent to $24.59 while Oracle Corp gained 2 percent to $30.70.

US crude oil prices rose 1.6 percent to $101.18 a barrel after hitting a 14-month high above $102 a barrel on a sharp decline in crude stockpiles in the United States and political unrest in Egypt. The S&P energy sector index ended flat.

Health providers were in focus after the Obama administration said it wouldn't require employers to provide health insurance for their workers until 2015, delaying a key provision of the healthcare reform law by a year.

Tenet Healthcare fell 4.3 percent to $43.64. Universal Health Services dropped 3.5 percent to $65.82.

On the NYSE, decliners beat advancers by a ratio of about 3 to 2. On the Nasdaq, the trend was the opposite, with nearly seven stocks rising for every five that fell. - Reuters