US stocks rallied to close out the trading week on Friday as the S&P 500 set a closing record for the third time in five days after an upbeat US jobs report and data on Chinese manufacturing eased concerns about slowing global growth.

Job growth slowed less than forecast last month, as a drag from a strike at General Motors Co was made up for in other areas of the labor market, while job gains in the prior two months were stronger than previously thought.

“A nice surprise, and also there were upwards revisions for September and August,” said Jeff Kravetz regional investment strategist at US Bank Wealth Management in Phoenix, Arizona. “To us that is an indication of the resiliency of the economy this late in the cycle and for today that is what is putting investors at ease and putting them on a risk-on mode here.”

The strong jobs number helped overshadow a report that showed the manufacturing sector contracted for a third straight month.

Along with the S&P’s new high, the NASDAQ Composite eclipsed its July closing record. The S&P has climbed for four straight weeks, its longest streak since February, while the NASDAQ has gained in five straight weeks as quarterly earnings have come in stronger than anticipated and US-China trade rhetoric has appeared to be productive.

The Dow Jones Industrial Average sat less than 12 points from a closing record.

Before the report, sentiment was supported by data showing China manufacturing activity unexpectedly expanded last month, easing concerns about a slowdown in Chinese demand as a result of US tariffs.

The Dow Jones Industrial Average on Friday rose 300.86 points, or 1.11 percent, to 27,347.36, the S&P 500 gained 29.36 points, or 0.97 percent, to 3,066.91 and the NASDAQ Composite added 94.04 points, or 1.13 percent, to 8,386.40.

For the week, the Dow rose 1.44 percent, the S&P 500 climbed 1.47 percent and the NASDAQ rose 1.74 percent.

US-China trade news remained supportive for stocks, as Chinese state-run Xinhua news agency reported the two countries have “reached consensus on principles.”

Earlier, US Secretary of Commerce Wilbur Ross said the “phase one” trade pact with China appeared to be in good shape.

About 76 percent of the 356 S&P 500 companies that have reported so far have beaten profit estimates, according to Refinitiv data.

However, profit growth forecasts for the next four quarters have been revised lower, even as expectations for a decline in third-quarter earnings have shrunk to 0.8 percent from 2.2 percent at the start of last month.

Oil major Exxon Mobil Corp rose 3 percent after it beat recently lowered third-quarter profit expectations.

The energy sector gained 2.5 percent as the best-performing S&P sector, and oil prices jumped on trade deal progress.

Qorvo Inc jumped 20.23 percent after the Apple Inc supplier announced a US$1 billion share buyback plan and forecast third-quarter revenue above expectations.

However, Pinterest Inc plunged 17.02 percent after the online scrapbook company missed quarterly revenue estimates.

Advancing issues outnumbered declining ones on the New York Stock Exchange by a 2.81-to-1 ratio; on NASDAQ, a 2.86-to-1 ratio favored advancers.

The S&P 500 posted 44 new 52-week highs and two new lows; the NASDAQ Composite recorded 113 new highs and 39 new lows.