By Anora Mahmudova and Carla Mozee, MarketWatch

Ace to buy Chubb in $28 billion deal

U.S. stocks finished higher Wednesday as investors looked beyond the latest developments in Greece and focused on economic data.

The main indexes pared early morning gains, aided by a sharp drop in energy stocks. The S&P 500 closed up 14.31 points, or 0.7%, at 2,077.42. Financials led the gains on the benchmark index, while energy stocks--the only sector trading lower--fell following a sharp drop in oil prices.

The Dow Jones Industrial Average finished up 138.40 points, or 0.8%, at 17,757.91. The Nasdaq Composite gained 26.26 points, or 0.7% to close at 5,013.12. All three indexes, however, are still down about 1% for the week to date.

Greece is going ahead with a referendum on Sunday to decide whether to accept the austerity demands of its creditors. Talks over the past few weeks to negotiate a bailout deal ended without a deal, and Greece is now in arrears on its IMF loan payment.

Meanwhile, investors assessed economic reports as well as monthly car sales.

Earlier, futures got a lift after the Financial Times reported Greek Prime Minister Alexis Tsipras is ready to accept nearly all of the conditions (http://www.marketwatch.com/story/greek-pm-tsipras-ready-to-accept-bailout-terms-ft-2015-07-01) to a new bailout deal that its international lenders proposed over the weekend. But subsequent reports on the debt talks threw cold water on the idea of a new deal being accepted.

Follow the latest news in the Greek debt crisis (http://www.marketwatch.com/story/greek-debt-crisis-latest-news-on-wednesday-2015-07-01).

Albert Brenner, director of asset allocation strategy at People's United Wealth, commenting on rising prices, said that it appeared investors changed their minds about what impact Greece's leaving of the eurozone will have on the rest of the continent.

"Investors observed the higher degree of unity among eurozone ministers when dealing with Greece and are betting that Grexit will not be followed by other peripheral states," Brenner said.

He also noted that while Greece has a terrible debt problem, IMF's austerity prescriptions are counterproductive and unlikely to help the country's economy.

Signs the market thinks a Greece deal is probable (http://www.marketwatch.com/story/signs-the-market-thinks-a-greece-deal-is-probable-2015-07-01)

ECB's dilemma: To keep Greek banks alive, or not? (http://www.marketwatch.com/story/ecbs-dilemma-to-keep-greek-banks-alive-or-not-2015-07-01)

Matthew P. Kaufler, portfolio manager at Federated Investors, said ADP number, while not the most reliable data point, is still pointing to continued growth in the labor market.

"The economy is approaching full employment and consumers are becoming more confident. We view that as a positive," Kaufler said.

In economic news, a report on private-sector hiring showed 237,000 news jobs (http://www.marketwatch.com/story/private-sector-adds-237000-jobs-in-june-adp-2015-07-01-891185)were created in June, topping economists' estimates. Official government reports on monthly job gains is due to be released on Thursday, with economists forecasting 225,000 jobs created last month.

U.S. manufacturers grew in June at fastest rate in five months: ISM (http://www.marketwatch.com/story/us-manufacturers-grew-in-june-at-fastest-rate-in-five-months-ism-2015-07-01)

Corporates: Chubb (CB) shot up 26% after ACE (ACE) said it plans to buy the speciality-insurance company in a cash-and-stock deal valued at $28.3 billion (http://www.marketwatch.com/story/ace-agrees-to-buy-rival-insurer-chubb-for-283-billion-2015-07-01-71034524). ACE shares climbed 0.8%. ACE said the deal will immediately boost per-share earnings and book value and generate $650 million in savings.

General Motors (GM) shares fell 0.9% after the car maker reported a sharp drop in monthly sales. Ford Motors (F) shares were also 0.2% lower.

Chrysler, Ford Sales rise in June, GM's fall (http://www.marketwatch.com/story/chrysler-ford-sales-rise-in-june-gms-fall-2015-07-01)

For more on today's notable movers read Movers & Shakers column (http://www.marketwatch.com/story/constellation-general-mills-ford-gm-in-the-spotlight-2015-07-01).

Other markets: European stocks rose 1.5% on Wednesday's developments out of Greece. Asian markets overnight finished mixed. Stocks in Shanghai sank 5.2%, but Japan's Nikkei picked up 0.5%.

Oil futures (http://www.marketwatch.com/story/oil-eyes-5-week-low-after-surprise-us-supply-climb-2015-07-01) dropped more than 4%, settling at their lowest level since late April after government data revealed an unexpected increase in weekly crude supplies.

Gold prices (http://www.marketwatch.com/story/gold-dips-as-greek-hopes-upbeat-adp-report-weigh-2015-07-01) edged to a one month low. The dollar was up against most of its rivals on the ICE Dollar Index .

Subscribe to WSJ: http://online.wsj.com?mod=djnwires