Stocks rallied on Friday after President Donald Trump said China and the U.S. reached the first phase of a substantial trade deal that delays tariff hikes that were set to kick in next week.

The Dow Jones Industrial Average surged 319.92 points, or 1.2% to close at 26,816.59, led by Apple which surged to an all-time high. The S&P 500 rose 1.1% to 2,970.27, while the Nasdaq Composite jumped 1.3% to 8,057.04. The gains helped the Dow and S&P 500 snap a three-week losing streak. The Dow and S&P 500 gained 0.9% and 0.6%, respectively, for the week. The Nasdaq ended the week up 0.9%.

Trump told reporters at the Oval Office that phase one of the trade deal will be written over the next three weeks. The major indexes hit their session highs on this comment, with the Dow rising more than 500 points. Trump made his comments after meeting with Chinese Vice Premier Liu He.

As part of this phase, China will purchase between $40 billion and $50 billion in U.S. agricultural products. Trump also said the deal includes agreements on foreign-exchange issues with China. In exchange, the U.S. agreed to hold off on tariff hikes that were set to take effect Tuesday.

Treasury Secretary Steven Mnuchin said both sides struck an "almost complete agreement" on currency and financial services issues. Phase two of the deal will "start almost immediately" after the first one is signed, Trump said.