NEW YORK (Reuters) - U.S. stocks rose on Friday, boosted by better-than-expected job growth in March, which eased concerns of an economic slowdown that have periodically roiled financial markets over the past year.

With Friday’s gains, the benchmark S&P 500 has closed higher for seven trading days in a row, its longest winning streak since October 2017.

The Labor Department said nonfarm payrolls rose by 196,000 jobs in March, topping the 180,000 new jobs forecast by economists polled by Reuters. Data for February was revised upward to a gain of 33,000 jobs instead of the previously reported 20,000, the smallest gain since September 2017.

The data provided reassurance two weeks after the yield curve between three-month Treasury bills and 10-year notes briefly inverted, in what is commonly viewed as a sign of an oncoming recession.

“The yield curve inversion freaked people out, got them thinking about a recession,” said Andrew Slimmon, senior portfolio manager at Morgan Stanley Investment Management in New York. “Data like today’s takes that off the table.”

However, wage increases slowed in March, leaving the data broadly supportive of the Federal Reserve’s decision to suspend its three-year campaign to tighten monetary policy.

A dovish Fed along with hopes for a U.S.-China trade agreement have lifted the S&P 500 to its highest level since Oct. 9, putting the index only 1.3% below its record closing high.

FILE PHOTO: Traders work on the floor at the New York Stock Exchange (NYSE) in New York, U.S., April 4, 2019. REUTERS/Brendan McDermid/File Photo

The Dow Jones Industrial Average rose 40.36 points, or 0.15%, to 26,424.99, the S&P 500 gained 13.35 points, or 0.46%, to 2,892.74 and the Nasdaq Composite added 46.91 points, or 0.59%, to 7,938.69.

Stocks across the world also got a lift from President Donald Trump’s comments on Thursday that Beijing and Washington were close to a trade deal that could be announced within four weeks. Trump later said he would not predict that a deal will be reached.

Next week, corporate earnings will come into greater focus with major U.S. banks scheduled to report quarterly results. Analysts expect earnings for S&P 500 companies to fall year-over-year for the first time since 2016.

On Friday, energy stocks jumped 1.7%, the biggest percentage gain among S&P 500 sectors, as oil prices firmed after the release of the U.S. jobs data and on expectations that conflict in Libya could tighten supply.

Technology stocks rose 0.4%, rebounding from Thursday’s decline as shares of Apple Inc and Microsoft Corp rose.

Dow Inc shares helped cap gains on the Dow Industrials. The shares dropped 4.1% as J.P. Morgan started coverage of the company, which was spun off from DowDuPont Inc, with an “underweight” rating.

Boeing Co shares dipped 1.0% after UBS cut its price target and said the preliminary report following last month’s fatal Ethiopian Airlines crash pointed to MCAS anti-stall software as a contributor to the crash. The software has also been implicated in the fatal crash in October of a Lion Air 737 MAX jet in Indonesia.

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

The S&P 500 posted 34 new 52-week highs and no new lows; the Nasdaq Composite recorded 75 new highs and 23 new lows.

Volume on U.S. exchanges was 6.24 billion shares, compared to the 7.33 billion average for the full session over the last 20 trading days.