The bulls couldn't hold the line. After rising to an all-time high earlier Monday, the S&P 500 closed just shy of a record.
The S&P 500 soared above the key 1,850 level in the afternoon, before pulling back late in the day to end at 1,847.71.
The Dow Jones industrial average added just over 105 points. The Nasdaq also gained ground.
Stocks have bounced back from a rough January, when investors were rattled by turmoil in emerging markets. The S&P 500, which fell 3% in January, is now flat for the year.
J.J. Kinahan, chief derivatives strategist at TD Ameritrade, said investors have been encouraged by a flurry of corporate deal making and stock buybacks announced in recent weeks. "There seems to be some buying momentum in the market," he said.
Investors are also looking ahead to testimony from Federal Reserve chair Janet Yellen on Thursday. Yellen told lawmakers earlier this month that the Fed will continue to taper its bond buying program this year, but she stressed the need to keep interest rates low for a long time.
While the U.S. economy has shown some signs of weakness, many economists say major storms in December and January distorted the data. This week, investors will sort through reports on housing, consumer spending and the government's second reading of fourth-quarter gross domestic product -- the broadest measure of economic growth.
Meanwhile, corporate earnings have also helped give stocks a boost.
Earnings for the companies in the S&P 500 that have reported results so far grew 8.5% on average in the fourth quarter, according to FactSet Research. The growth was stronger than what analysts had predicted, with 72% of the S&P 500 topping expectations.
Companies have also reported improved sales numbers, though overall revenue growth remains weak. In the current quarter, analysts say cold weather could weigh on corporate sales and profits.
Related: Fear & Greed Index idling in neutral
Icahn vs. eBay: Activist investor Carl Icahn blasted eBay (EBAY) CEO John Donahoe for failing to address "blatant" conflicts of interest involving two members of the company's board, venture capitalist Marc Andreessen and Scott Cook.
Icahn, who owns a "significant position" in eBay stock, has proposed separating the company's traditional online auction business from its PayPal payment processing business.
eBay shot back, issuing a statement denouncing Icahn's "mudslinging attacks" on its directors.
Shares of eBay were up despite the noise. Traders on StockTwits seemed to believe the fight was just getting started.
"This $EBAY will be a freaking war. war. Andreeesen will NOT back down and take it to twitter with Carl. Thrilling board room drama ahead," said howardlindzon.
If they can't settle their differences on Twitter (TWTR), another trader suggested swords.
"$EBAY I am in favour of Icahn rocking their boat. Money men need to be challenged AND be forced to raise their sword every now and then," said Morpheus.
Netflix gets connected. Comcast (CCV) said Sunday that it will allow Netflix (NFLX) to connect directly to its broadband network, allowing for faster streaming. Netflix is expected to pay Comcast for the access, yet it's unclear how the added expense may impact subscription fees.
Some traders were surprised to see Netflix shares move higher, given the uncertainty around the cost of the deal with Comcast.
"$NFLX This stock is moving the wrong direction. Same service for more money?" said zer0sum.
At least one bearish trader was considering changing sides.
"$NFLX Maybe I should just go long and watch it hit $1000 in a month for no reason," said tangsting.
HSBC (HSBC) shares slid after the bank reported earnings that came in below expectations.
Blackberry (BBRY)shares rose on rumors that it could replace Microsoft (MSFT) to power Ford's (F) future generation cars with smartphone technology.
European markets ended higher, while most Asian markets moved lower.
The G20 -- the world's 19 richest nations and the European Union -- pledged to install policies that will add $2 trillion to the world economy over the next five years. The group committed to "significantly raise global growth," according to a statement following a weekend meeting in Australia.
In Ukraine, the whereabouts of ousted President Viktor Yanukovych remain unknown. Meanwhile, the acting government has issued an arrest warrant for Yanukovych over the killings of civilians in last week's bloodshed in Kiev.