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."
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."
Stocks have gotten a boost recently from better-than-expected earnings. Of the 206 S&P 500 companies that reported through Monday morning, 78% have topped analyst expectations, according to FactSet.
Walgreens Boots Alliance, AT&T and Spotify are among the companies that reported stronger-than-forecast profits on Monday. Walgreens rose as much as 1.9% before trading 0.7% higher. Spotify surged 16.2%.
"The US equity markets have been surprised by the strength of the 3Q results," said Sean Darby, global equity strategist at Jefferies, in a note. "With the US earnings season producing a positive string of results and investors positioning extremely risk averse alongside negative US real interest rates, we believe there is further upside for global equities."
Improvement on the U.S.-China trade front has also lifted investor sentiment recently. U.S. and Chinese officials said they were "close to finalizing" some parts of a trade agreement.
Chinese state-run news agency Xinhua also pointed to progress being made on trade. The world's two largest economies have imposed tariffs on billions of dollars' worth of one another's goods since the start of 2018, battering financial markets and souring business and consumer sentiment.
Apple, UnitedHealth and J.P. Morgan Chase are among the stocks helping the S&P 500's bid to fresh record highs. Apple shares are up more than 11% in October amid optimism around iPhone 11 sales. UnitedHealth has rallied 13.7% for the month, while J.P. Morgan Chase has gained 7.5% amid expectations that interest rates have bottomed.
Monday's moves come ahead of a highly anticipated Fed meeting later this week. The Fed is largely expected to cut rates by 25 basis points for the third time this year.
—CNBC's Sam Meredith contributed to this report.