Aug 10 (Reuters) - U.S. stocks climbed on Monday, giving the S&P 500 its biggest gain since May as indexes bounced back sharply from last week’s losses, buoyed by gains in commodity-related shares and optimism over Warren Buffett’s latest deal.

Disappointing economic data in China boosted hopes for additional stimulus from Beijing, lifting Chinese stocks. Adding to investor optimism, Greece and international creditors could wrap up a multibillion-euro bailout accord by Tuesday.

Buffett’s Berkshire Hathaway said it would buy Precision Castparts in a deal valuing the company at $32.3 billion. Precision Castparts’ shares jumped as much as 19.1 percent to $230.92, while Berkshire Class B shares dipped 0.1 percent to $143.42.

“We’ve had a whole lot of M&A throughout the year, and that’s positive because it means businesses are upbeat on the prospects for the economy,” said Peter Cardillo, chief market economist at Rockwell Global Capital in New York.

The Dow Jones industrial average rose 241.79 points, or 1.39 percent, to 17,615.17, the S&P 500 gained 26.61 points, or 1.28 percent, to 2,104.18 and the Nasdaq Composite added 58.25 points, or 1.16 percent, to 5,101.80.

The S&P 500 registered its biggest daily percentage gain since May 8.

On Friday, the Dow closed down for the seventh straight day after solid July jobs data pried the door open a little wider for a rate hike in September.

With U.S. interest rates near zero for nearly a decade, debt has been cheap. But with the Federal Reserve widely expected to hike rates later this year, merger and acquisition activity has increased.

July was the seventh-strongest month for global deal activity since 1980. Through July, cross-border M&A activity totaled $913.5 billion, up 23 percent from a year earlier, according to Thomson Reuters data.

In other deal news, ammonia maker CVR Partners’ deal to buy Rentech Nitrogen Partners for about $533 million sent Rentech soaring 28.6 percent to $13.25. CVR shares were down 2.9 percent at $10.38.

Twitter shares jumped 9.1 percent to $29.50 after CEO Jack Dorsey joined other insiders in buying more shares, while the company also clinched a multiyear partnership with the National Football League.

Advancing issues outnumbered declining ones on the NYSE by 2,329 to 734, for a 3.17-to-1 ratio on the upside. On the Nasdaq, 1,937 issues rose and 856 fell for a 2.26-to-1 ratio favoring advancers.

The benchmark S&P 500 index posted 35 new 52-week highs and three new lows; the Nasdaq Composite recorded 58 new highs and 85 new lows. (Additional reporting by Tanya Agrawal in Bengaluru; Editing by Savio D‘Souza, Nick Zieminski and Peter Galloway)