Despite a day of mostly listless trading, the Standard & Poor's 500 index managed to notch another all-time high.
The index on Monday inched past its most recent record-high close set on Friday, extending its gain for the year to 10.4 percent. The Dow Jones industrial average also ended higher after briefly eclipsing its most recent high. The Nasdaq composite ended lower.
The latest milestone for the S&P 500 came on a day when the major U.S. stock indexes mostly hovered between small gains and losses as investors weighed the implications of an economic slowdown in Japan that worsened in the third quarter into a recession. Energy stocks fell as the price of crude oil resumed its slide.
“Japan definitely started us on a bit of a negative tone with the economy back into recession,” said Chris Gaffney, senior market strategist at EverBank Wealth Management.
The major stock indexes started off in negative territory early Monday as the markets reacted to data showing the world's third-largest economy unexpectedly shrank at a 1.6 percent annual pace in the third quarter after contracting 7.1 percent the previous quarter.
Tokyo's benchmark Nikkei stock index lost 3 percent.
U.S. markets veered lower much of the morning. By afternoon, though, stocks began to pare some their losses as traders cheered several pieces of corporate deal news.
Shares in Botox-maker Allergan and oilfield services company Baker Hughes were among the biggest gainers.
In the end, the S&P rose 1.50 points, or 0.1 percent, to 2,041.32. That's just ahead of its previous all-time high close of 2,039.82 on Friday.
The Dow gained 13.01 points, or 0.1 percent, to 17,647.75. The Nasdaq composite fell 17.54 points, or 0.4 percent, to 4,671.
The three major stock indexes are up for the year.
Stocks have been mostly rising since Oct. 15, when the S&P 500 nearly fell into a “correction,” a trading term for a drop of 10 percent or more from a recent peak.
Generally strong corporate earnings results and solid U.S. economic data have helped blunt the impact of global economic uncertainty.
News that Japan is in a recession stoked those fears once again, but the impact on the market was tempered, given the day's narrow trading range, noted Sean Lynch, managing director of global equity research and strategy for Wells Fargo Private Bank.
“The U.S. economy is a consumption-driven economy,” Lynch said. “The U.S. is in pretty good footing here as we head into the last month of the year.”
Six of the 10 sectors in the S&P 500 ended lower, with energy stocks falling most. The sector is down 3.8 percent this year, and is the only one in the red for 2014. Utilities rose the most.
Concerns over the global economy were dominant in the oil markets. Benchmark U.S. crude fell 18 cents to $75.64 a barrel in New York.
The yield on the 10-year U.S. Treasury note rose to 2.34 percent from 2.32 percent late Friday.
In commodities trading, the price of gold slipped $2.10 to $1,183.50 an ounce, silver fell 26 cents to $16.06 an ounce and copper edged down a penny to $3.04 a pound.
Among stocks making big moves Monday:
— Pharmaceutical giant Actavis agreed to buy Allergan for $66 billion. Allergan shares surged 5.3 percent, gaining $10.55 to $209.20. Actavis added $4.17, or 1.7 percent, to $247.94.
— Baker Hughes jumped 8.9 percent on news it has agreed to be acquired by rival Halliburton in a deal worth $34.6 billion in cash and stock. Baker Hughes rose $5.34 to $65.23. Halliburton fell $5.85, or 10.6 percent, to $49.23.
— DreamWorks Animation slid 14.3 percent following a media report over the weekend that talks between the animation studio and toy maker Hasbro have faded, dimming the likelihood that Hasbro will buy the studio known for movies such as “Shrek” and “Kung Fu Panda.” DreamWorks fell $3.71 to $22.31. Shares in Hasbro rose $2.35, or 4.4 percent, to $56.37.
In other energy trading, Brent crude, the international benchmark, fell 10 cents to $79.31. Oil fell initially following news that Japan's economy had unexpectedly slipped back into recession.
Meanwhile, natural gas soared on forecasts of below-normal temperatures in the Midwest and the eastern U.S. Natural gas rose 32 cents, or 8 percent, to $4.341 per 1,000 cubic feet. Wholesale gasoline lost 1.6 cents to $2.026 a gallon and heating oil dropped 1.2 cents to $2.404 a gallon.