Stocks surged Friday after President Trump announced the U.S. and China reached a partial trade deal, defusing trade tensions between the world’s two largest economies.

The Dow Jones Industrial Average ended up 319 points, or 1.21%, while the S&P 500 finished 1.09% higher. The tech-heavy NASDAQ climbed 1.34% higher. The Dow rose more than 500 points at it peak but lost some of its gains before the market closed.

Trump told reporters in the Oval Office the U.S. and Beijing reached a “substantial phase one deal” following negotiations in Washington, D.C., this week. The deal, however, has not yet been written and the process could take several weeks, Trump said.

The limited trade accord, which Trump said he and Chinese President Xi Jinping could sign at the Asia-Pacific Economic Cooperation meetings in mid-November, could pave the way for a more comprehensive agreement.

Under the pact, China will commit to buying between $40 billion and $50 billion in American agricultural products, while the U.S. will not move forward with raising tariffs from 25% to 30% on $250 billion worth of products from China. The accord will also include provisions on intellectual property.

The Trump administration is also set to impose 15% levies on a slew of consumer goods on Dec. 15.

Trump said earlier this month his administration would not prefer a partial trade deal, saying instead his "inclination is to get a big deal.”