(Reuters) - Wall Street’s main indexes hit record highs on Thursday following news that the United States had reached a “deal in principle” with China to resolve a trade war that has rattled markets for nearly two years.

Stocks were boosted in the morning when President Donald Trump tweeted that the United States was close to a deal ahead of Sunday, when a new round of tariffs on Chinese goods has been set to go into effect. Later in the day, reports emerged that the two countries had reached a deal in principle.

Wall Street has focused on the new round of tariffs, hopeful they would at least be delayed as the world’s two largest economies make progress on an initial trade deal.

“It’s been a long, painful process to come to a deal, if this is it,” said Rick Meckler, partner at Cherry Lane Investments in New Vernon, New Jersey. “Certainly it’s something that the market has been looking for as maybe the last real near-term drawback to the market.”

(Graphic: U.S.-China trade war timeline Image link: )

The Dow Jones Industrial Average .DJI rose 220.75 points, or 0.79%, to 28,132.05, the S&P 500 .SPX gained 26.94 points, or 0.86%, to 3,168.57, and the Nasdaq Composite .IXIC added 63.27 points, or 0.73%, to 8,717.32.

FILE PHOTO: Traders work on the floor at the New York Stock Exchange (NYSE) in Manhattan, New York City, U.S., December 21, 2016. REUTERS/Andrew Kelly/File Photo

All three indexes hit intraday records, while the S&P 500 and the Nasdaq posted record high closes.

Investors expressed some wariness of placing too much faith in the trade developments given the continued ups and downs during the prolonged U.S.-China trade saga.

The benchmark S&P index has gained 26% so far in 2019, fueled by interest rate cuts by the U.S. Federal Reserve and better-than-expected corporate profits along with optimism over the U.S.-China trade relations.

On Wednesday the Fed held interest rates steady in its last policy meeting of the year and signaled borrowing costs will not change anytime soon. On Thursday, Europe’s central bank held its rates steady, and its new head struck a more upbeat tone on the economy.

Among S&P 500 sectors, financials .SPSY and energy .SPNY gained the most on Thursday, while defensive groups, including real estate .SPLRCR and utilities .SPLRCU, were negative.

In company news, Facebook Inc FB.O shares fell 2.7% after the Wall Street Journal reported that the U.S. Federal Trade Commission is considering seeking a preliminary injunction against the social media company.

Delta Air Lines Inc DAL.N shares rose 2.9% as the company projected another annual rise in profit and revenue in 2020.

Advancing issues outnumbered declining ones on the NYSE by a 1.89-to-1 ratio; on Nasdaq, a 1.85-to-1 ratio favored advancers.

The S&P 500 posted 83 new 52-week highs and two new lows; the Nasdaq Composite recorded 195 new highs and 56 new lows.

About 8 billion shares changed hands on U.S. exchanges, well above the 6.7 billion daily average over the last 20 sessions.