US stocks closed higher on Wednesday but were down from earlier highs as energy stocks declined and Greece's debt crisis showed no clear signs of resolution. The benchmark S&P 500's energy sector was dragged down by the biggest slide in oil prices since April after traders were surprised by a report that showed US crude stockpiles rose for the first time in more than two months.
Euro zone central bank chiefs kept in place their cap on a funding lifeline to Greece, maintaining pressure as Greece's lenders run out of cash. The country's banks have been shut since Monday ahead of a Sunday referendum on the bailout package offered by its international lenders last week.
Finance Minister Yanis Varoufakis said Athens aims to secure a deal Monday and would be willing to accept "strict" conditions in a new bailout package, if the sustainability of Greece's debt is guaranteed.
Investor hopes for a Greek debt deal, which earlier had helped drive a rally, ebbed during the day, according to Michael Matousek, head trader at US Global Investors Inc in San Antonio. "Until it's all said and done they're just jockeying for position back and forth. The negotiation process still isn't over," Matousek said.
Many investors were also holding off ahead of Thursday's scheduled release of the closely watched US non-farm payroll report for June while the three-day weekend celebrating the US July Fourth holiday kept others away, said Brian Fenske, head of sales trading at ITG in New York.
While the market was primarily driven by Greece's woes, stronger-than-expected jobs and construction data gave stocks some support as did Swiss insurance giant ACE Ltd's $28 billion offer for upmarket property insurer Chubb Corp.
Chubb's shares ended up 26 percent to $119.99, making it the second biggest boost for the S&P 500. Rival Travellers Cos Inc rose 2.7 percent, the biggest driver for the Dow.
US private employers added 237,000 jobs in June, the biggest gain since December, while construction spending rose in May to its highest level in just over 6-1/2 years, reports showed.
The Dow Jones industrial average rose 138.4 points, or 0.79 percent, to 17,757.91, the S&P 500 gained 14.31 points, or 0.69 percent, to 2,077.42, and the Nasdaq Composite added 26.26 points, or 0.53 percent, to 5,013.12.
The S&P energy sector fell 1.3 percent, the only S&P sector in the red on Wednesday. US crude oil futures settled down 4.2 percent at $56.96 a barrel. Brent settled off 2.5 percent at $62.01.
Airline stocks tumbled after the US Department of Justice said it was investigating whether some carriers were colluding to keep ticket prices high.
Advancing issues outnumbered declining ones on the NYSE by 1,914 to 1,179, for a 1.62-to-1 ratio on the upside; on the Nasdaq, 1,475 issues rose and 1,288 fell for a 1.15-to-1 ratio favouring advancers.
The benchmark S&P 500 index posted 14 new 52-week highs and 22 new lows; the Nasdaq Composite recorded 76 new highs and 89 new lows.
About 6.4 billion shares changed hands on US exchanges, below the 7.4 billion average for the last five sessions, according to data from BATS Global Markets.