Stocks jumped on Thursday as sources tell CNBC a so-called phase one trade deal between the U.S. and China has been agreed to in principle.

The S&P 500 gained 0.9% to end the day at 3,168.57, notching a record close. The Nasdaq Composite also posted an all-time closing high, rising 0.7% to 8,717.32. The Dow Jones Industrial Average closed 220.75 points higher, or 0.8% at 28,132.05. All three of the major averages reached intraday records, their first since Nov. 27.

U.S. negotiators have the terms of the deal ready for President Donald Trump's review. CNBC confirmed reports from earlier in the day that said U.S. negotiators are offering to cancel new China tariffs and reduce existing levies on Chinese goods by up to 50% on $360 billion worth of imports. The latest trade news comes ahead of a key Sunday deadline. If an agreement is not reached by Sunday, additional U.S. levies on Chinese products will take effect.

Trump said in a tweet earlier in the day both sides were getting "VERY close to a BIG DEAL with China." They want it, and so do we!" The major indexes hit record highs following Trump's tweet.

tweet

"People are very optimistic here that all the risks cited are going away," said Ilya Feygin, senior strategist at WallachBeth Capital. "It just seems like people who have been skeptical have been forced into the market."

He noted that weekly inflows into equity ETFs have ranged between $6 billion and $8 billion in recent weeks.

Caterpillar shares jumped 1.9% on Thursday while Micron Technology advanced 3.5%. The VanEck Vectors Semiconductor ETF (SMH) and the iShares PHLX Semiconductor ETF (SOXX) both rose more than 2.5% and hit all-time highs.

Bank stocks also got a lift as Treasury yields rose. The SPDR S&P Bank ETF (KBE) climbed 2.9% and hit a 52-week high. J.P. Morgan Chase, Bank of America and Citigroup all closed at least 1.6% higher. The benchmark 10-year Treasury yield advanced to 1.896% while the 2-year rate was at 1.66%.