Dollar General surged 12 percent after offering $9.7 billion for Family Dollar, which rallied 4.9 percent. Southwest Airlines and Delta Air Lines led gains among industrial companies as oil prices fell. Homebuilders rose as confidence in the industry climbed to the highest level in seven months. Internet and biotechnology stocks rallied, continuing to pare losses from earlier this year.
The S&P 500 rose 0.9 percent to 1,971.74, within 0.8 percent of an all-time high. The Dow Jones Industrial Average gained 175.83 points, or 1.1 percent, to 16,838.74. The Nasdaq Composite Index jumped 1 percent to the highest level since 2000.
"People that were concerned about the possibility of a serious deterioration of the Russia-Ukraine situation and had no idea what was going to happen over the weekend came in this morning with a different perspective," said Marshall Front, chief investment officer at Chicago-based Front Barnett Associates. His firm manages $800 million. "The market opened up higher and we've been creeping up since then with some positive housing sentiment figures."
Ukrainian Foreign Minister Pavlo Klimkin met his Russian counterpart Sergei Lavrov for more than five hours of talks in Berlin, as they sought to ease tension after officials in Kiev said troops had partially destroyed an armed convoy from Russia.
In Iraq, Iraqi and Kurdish forces retook control of the Mosul Dam, Iraqiya television reported. The U.S. widened its airstrikes in Iraq at the weekend to help secure the dam near Mosul, Iraq's largest northern city, after it was seized by Islamist militants.
Israel and Hamas agreed to extend their truce, media on both sides of the conflict reported, providing more time for negotiations on a long-term accord to end violence that has devastated Gaza.
The S&P 500 fell as much as 3.9 percent from a record reached on July 24 amid growing concern over global conflicts from Ukraine to Gaza and Iraq. The benchmark index gained 1.2 percent last week as signs of a slowing economy stoked bets central banks will leave interest rates near record lows for longer.
The Federal Reserve is watching economic data to help gauge adjustments to monetary stimulus. The central bank remains on pace to wind down its monthly bond purchases in October. Fed Chair Janet Yellen has said officials will keep its benchmark interest rate low for a "considerable time" after the bond buying ends. The central bank releases minutes from its July meeting on Wednesday.
Clothing retailer Urban Outfitters reported earnings on Monday that beat analysts' estimates. Of the S&P 500 companies that have reported quarterly results this season, 76 percent have topped earnings estimates, while 65 percent exceeded sales projections, according to data compiled by Bloomberg.
Dollar General jumped 12 percent, the most in the S&P 500, to a record $64.14. The company proposed to pay $78.50 a share in cash for Family Dollar, challenging Dollar Tree's takeover bid of $74.50 a share in cash and stock. Dollar General forecast synergies of as much as $600 million on an annual basis, three years after completion of the deal.
Eight of 10 main groups in the S&P 500 advanced. Industrial stocks had the largest increase, surging 1.5 percent as airline shares climbed amid falling oil prices.