The S&P 500 hit a record high on Monday as investors cheered strong earnings and progress on U.S.-China trade.

The S&P 500 rose 0.6% to 3,039.42, closing above 3,027.98, the record set on July 26. The Dow Jones Industrial Average gained 0.5%, or 132.66 points to 27,090.72. The Nasdaq Composite climbed 1% to 8,325.99.

"The market is sending you a very strong message: The cyclical stocks are recovering and they are outperforming," said Andrew Slimmon, managing director at Morgan Stanley Investment Management. "If the economy was going to hit a really bad patch, these stocks wouldn't be recovering."

"The market is finally breaking out of this trading range and it is headed higher," he said. "The economic data has been better than expected. Earnings have come in better than expected."

Microsoft shares contributed to Monday's gains, rising 2.5% on news the company won a $10 billion cloud contract from the Defense Department. AT&T gained more than 4% after announcing a three-year plan that includes the addition of two new board members and the sale of up to $10 billion worth of non-core businesses in 2020. Alphabet climbed nearly 2% ahead of earnings, but the stock slipped in after-hours trading after the company's results were released.

Monday's move to a record high extended the second-longest ever bull market to 3,885 days, by far the second-longest ever, according to data from Bespoke Investment Group.

President Donald Trump called in a tweet the move to record highs a "big win for jobs, 401-K's, and, frankly, EVERYONE."

tweet

After hitting a new high on July 26, the S&P 500 suffered a sharp sell-off amid fears of an economic recession in August. That month, the S&P 500 dropped 1.8%. The index struggled through September but has rebounded strongly in October. It is now up more than 6% from that August low.

Last week's 1.2% rise set the stage for a potential S&P 500 upside breakout, said Craig Johnson, chief market technician at Piper Jaffray.

"The technical backdrop improved last week as the SPX finally distanced itself from the magnetic 3,000-point level," Johnson said. "A close above 3,026 will validate a record high breakout and likely open the door to a new leg higher."