U.S. stock indexes closed higher Wednesday afternoon, though the major benchmarks ended the day well off session highs, after President Donald Trump signed the first phase of a trade pact with China, marking a truce in the dispute over import tariffs which has unsettled markets world-wide and slowed economic growth.

The Dow Jones Industrial Average DJIA, -0.87% rose 90.55 points, or 0.3%, at 29,030.22, while the S&P 500 index SPX, -1.11% gained 6.14 points, or 0.2% to 3,289.29, while the Nasdaq Composite Index COMP, -1.07% gained 7.37 points, or 0.1%, to close at 9,258.70.

All three major benchmarks set record intraday highs, while the Dow and S&P 500 ended the session at record closing levels.

At session highs on Wednesday, the Dow was up 187.92 points, or 0.6%, the S&P 500 had gained 15.51 points, or 0.5% and the Nasdaq Composite was up 47.49 points, or 0.5%.

What drove the market?

Trump and Chinese Vice Premier Liu He signed a long-awaited preliminary trade pact in the East Room of the White House White House Wednesday and investors were heartened by some of the details of the deal released by the Trump administration.

The text of the deal includes promises by the Chinese to increase their purchases of U.S. agricultural, manufacturing, and energy products, along with purchases of services, by more than $200 billion over the next two years, though it also states that “the parties acknowledge that purchases will be made at market prices based on commercial considerations.”

It also includes commitments by the Chinese to enforce intellectual property theft laws and a “bilateral evaluation and dispute resolution arrangement” that will encourage the U.S. and China to work jointly to resolves allegations of patent and copyright infringement or intellectual property theft.

During the singing ceremony, President Trump said it was “a great deal for both countries” and China’s Liu He called the pact a “landmark agreement.”

Investors and analysts said that the deal was more substantial than many critics of the trade negotiations had expected, with the magnitude of promised Chinese imports of U.S. goods larger than many had anticipated.

“I think what’s happening is that people are recognizing that, while there’s a lot of room to go with additional discussions with China, what is happening today is a real positive step,” Wayne Wicker, CIO of Vantagepoint Investment Advisers told MarketWatch.

Stocks did end the day, however, off their peaks, and Randy Frederick, vice president of trading and derivatives with the Schwab Center for Financial Research, called this action “classic ‘buy the rumor, sell the news,’ activity,” referring to the tendency for stock investors to bid up stock prices in the anticipation of good news and take profits when it comes to fruition.

“This market has been in a robust up trend, really since Oct. 11, the day Trump first announced a deal with China,” he added. “In this environment, with markets at record highs, it’s not surprising we’d see some caution.”

Read:Phase-one trade deal won’t end the uncertainty in markets, HSBC strategist says

Investors were also watching as U.S. fourth-quarter corporate results continue to roll in, with earnings so far coming in better than feared. “Less than 10% of the S&P 500 has reported, but so far 77% of companies have exceed earnings estimates, which is a little better than the historical average,” said Michael Arone, chief investment strategist at State Street Global Advisors.

“The expectations bar has been lowered so much that it doesn’t take a significant amount of effort for companies to overstep it,” he added.

In economic data, U.S. wholesale inflation rose 0.1% in December, according to the Labor Department’s producer-price index, below the 0.2% rise expected by economists, according to a MarketWatch poll. Year over year, producer prices rose just 1.3%, roughly half the rate in 2018.

A survey of manufacturing activity in New York state rose 1.5 points to 4.8 in January, above expectations of 3.6, according to Econoday.

A survey of business conditions in various Federal Reserve districts, known as the “Beige Book,” was released Wednesday afternoon, and indicated economic activity expanded “modestly” during the final six weeks of 2019 and the labor market remained tight with businesses reporting difficulty finding workers, although there were job cuts in the manufacturing, transportation and energy sectors.

Which stocks were in focus?

Target Corp. shares TGT, +0.82% fell 6.6% Wednesday, after the retailer said sales rose 1.4% between Nov. 1 and Dec. 31 in stores and through digital channels operating for at least 12 months, but warned that growth for the full quarter, which includes January, would likely come in less than half the 3% to 4% growth it had predicted.

UnitedHealth Group Inc. UNH, +0.99% reported Wednesday that its fourth quarter earnings rose beyond Wall Street expectations, though sales growth came up shy. The health insurer’s stock rose 2.8% Wednesday.

Fellow Dow component Goldman Sachs Group Inc. GS, +0.01% reported earnings that fell more than analysts expected, Wednesday morning. The investment and consumer bank’s stock was up 0.2%.

BlackRock Inc.’s BLK, +1.55% stock gained 2.3% Wednesday after it reported quarterly net profits rose 40% to $1.3 billion. The company’s fourth-quarter earnings of $8.29 a share exceeded analysts’ consensus forecasts. Expectations were for net profits of $1.2 billion, or $7.75 a share. The asset manager ended 2019 with $7.43 trillion in assets under management, an increase from $5.98 trillion exactly a year ago.

Bank of America Corp. BAC, -0.55% reported quarterly earnings of $6.99 billion in the fourth quarter, down from $7.28 billion a year earlier. Per-share earnings were 74 cents, more than the 68 cents predicted by analysts polled by FactSet. The bank had revenue of $22.35 billion, down from $22.68 billion. Analysts had expected $22.22 billion. Shares fell 1.8% Wednesday.

Apple Inc. AAPL, -3.17% shares were in focus after President Trump called on the company to “step up to the plate” and help U.S. authorities by unlocking phones used by “killers, drug dealers and other violent criminal elements, in a Tuesday-evening tweet. The company’s stock closed 0.4% lower.

How did other markets trade?

The yield curve flattened for a second day, with the yield on the 10-year Treasury note TMUBMUSD10Y, 0.701% falling 2.9 basis points to 1.788% and that of the closely watched 3-month Treasury bill TMUBMUSD03M, 0.092% rising about 1 basis point to 1.567%.

Oil prices fell Wednesday, as West Texas Intermediate crude for February US:CLG20 lost 42 cents, or 0.7%, to settle at $57.81 a barrel on the New York Mercantile Exchange. In precious metals, the price of an ounce of gold for February delivery US:GCG20 rose $9.40, or 0.6%, to settle at $1,554 an ounce on Comex.

The U.S. dollar fell 0.2% relative to a basket of its rival currencies, according to the U.S. Dollar index DXY, +0.03% .

In Europe stocks closed virtually unchanged, with the Stoxx Europe 600 SXXP, -0.66% ending the session at 419.63, though the U.K.’s FTSE 100 UKX, -0.70% added 0.3%.