The S&P 500 and the Dow Jones Industrial Average ended a three-day run of losses on Friday as optimism about the prospects for a U.S.-China trade agreement countered downbeat U.S. and China manufacturing data. The Nasdaq meanwhile marked its longest streak of weekly gains since late 1999.

Following Trump’s announcement last weekend of a delay in higher tariffs on Chinese imports, Bloomberg reported late Thursday that a summit between Trump and his Chinese counterpart Xi Jinping to sign a final trade deal could happen as soon as mid-March.

A private survey indicated China’s factory activity contracted for a third straight month in February, though at a slower pace, showing a marginal improvement in domestic demand as a flurry of policy stimulus kicked in from late last year.

ISM data showed manufacturing activity for February fell to its lowest point since November 2016, and the University of Michigan survey indicated consumer sentiment fell short of expectations in the month.

Friday marked the first close above 2,800 for the S&P since Nov. 8. The index closed 4.2 percent under its September record closing high. It has risen 11.8 percent so far this year, bolstered by trade hopes and the Federal Reserve’s cautious stance on interest rates.

For the week, the S&P gained 0.4 percent while the Dow fell 0.02 percent and the Nasdaq was up 0.9 percent.

Of the 11 major S&P 500 sectors, eight were gainers on the day. The healthcare sector rose 1.4 percent, providing the largest boost and supported by gains in companies including health insurer UnitedHealth Group which bounced back after falling for much of the week.

The consumer discretionary sector rose 0.9 percent, with the largest lift from Amazon.

Foot Locker shares rose 5.9 percent after the retailer beat quarterly same-store sales estimates and helped drive a 1.9 percent gain in shares of Nike Inc, the second biggest boost to the sector.

Gap was up 16 percent, making it the biggest percentage gainer in the S&P, after it said it would separate its better-performing Old Navy brand and close about 230 Gap stores.

The energy sector rose 1.8 percent despite a decline in oil prices. 

A Commerce Department report indicated inflation pressures remaining tame, which along with slowing domestic and global economic growth, gave more credence to the Federal Reserve’s “patient” stance toward raising interest rates further this year.

The personal consumption expenditures (PCE) price index excluding the volatile food and energy components rose 0.2 percent after a similar gain in November. That left the year-on-year increase in the so-called core PCE price index at 1.9 percent.

The core PCE index is the Fed’s preferred inflation measure. It hit the Fed’s 2 percent inflation target in March for the first time since April 2012.

Approximately 7.95 billion shares changed hands on the major domestic equity exchanges, as compared to the 7.27 billion share average over the past 20 trading days.