The major domestic equity indexes moved well into positive territory on Friday as upbeat earnings helped investors shrug off heightened trade anxieties and weaker-than-expected July jobs growth.

For the week, the S&P 500 and the Nasdaq gained ground, up 0.8 percent and 1.0 percent, respectively, while the Dow Jones Industrial Average was essentially flat. The S&P 500 notched its fifth straight weekly gain, its longest such streak of the year.

The second-quarter reporting season nears its final stretch with 406 of the companies in the S&P 500 having reported, 78.6 percent of which came in above Street estimates, according to Thomson Reuters data.

China launched its latest salvo in the ongoing trade spat, unveiling new tariffs on 5,207 goods imported from the United States, including liquefied natural gas (LNG) and some aircraft.

Earlier this week, Chinese officials promised retribution after the Trump administration proposed hiking tariffs to 25 percent on $200 billion worth of goods imported from China.

A report from the Labor Department indicated that the economy added 157,000 jobs in July, fewer than the 190,000 expected, though the unemployment rate edged down to 3.9 percent.

Other data showed that our trade deficit rose 7.3 percent in June to $46.3 billion, its largest increase since November 2016. The politically sensitive trade gap with China widened by 0.9 percent to $33.5 billion.

Shares of Apple rose modestly a day after becoming the first publicly-traded U.S. company to reach $1 trillion in market value.

The S&P consumer staples sector index rose 1.2 percent. Its advance was led by Kraft Heinz, up 8.6 percent after the packaged foods company topped quarterly earnings and revenue estimates.

Of the 11 major sectors of the S&P 500, energy was the sole percentage loser. Oil prices fell, weighed upon by concerns about trade and demand for crude, while hedge funds and other money managers cut their bullish crude bets this week.

Shares of Dish Network rose 14.5 percent following its better-than-expected quarterly earnings report.

Executives for American International Group tried to downplay weak earnings and promised a turnaround, nonetheless the insurer’s shares fell 2.7 percent.

Symantec was among the largest percentage losers on the S&P, falling 7.8 percent after announcing a workforce reduction and lowering its yearly revenue forecast.

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

Job Growth Slows

Job growth slowed more than expected in July due to the inability of companies to find qualified workers and the unemployment rate declined, pointing to tightening labor market conditions.

Nonfarm payrolls increased by 157,000 jobs last month, the Labor Department said on Friday. The economy created 59,000 more jobs in May and June than previously reported. The economy needs to create about 120,000 jobs per month to keep up with growth in the working-age population.

The unemployment rate fell one-tenth of a percentage point to 3.9 percent in July, even as more people entered the labor force in a sign of confidence in their job prospects. It rose in June from an 18-year low of 3.8 percent in May.

The slowdown in hiring last month likely is not the result of trade tensions, which have escalated in recent days, but rather because of a shortage of workers. There are about 6.6 million unfilled jobs in the nation. A survey of small businesses published on Thursday showed a record number in July of establishments reporting that they could not find workers.

According to the NFIB, the vacancies were concentrated in construction, manufacturing and wholesale trade industries. Small businesses said they had difficulty in filling positions that did not require skilled labor.

The shortage of workers is steadily pushing up wages. Average hourly earnings increased seven cents, or 0.3 percent, in July after gaining 0.1 percent in June. That kept the annual increase in wages at 2.7 percent in July.

Economists have warned that the tit-for-tat import duties, which have unsettled financial markets, could undercut manufacturing through disruptions to the supply chain and put a brake on the strong economic growth.

There have also been concerns that the trade tensions could dampen business confidence and lead companies to shelve spending and hiring plans. But a $1.5 trillion fiscal stimulus, which helped to power the economy to a 4.1 percent annualized growth pace in the second quarter, is assisting the United States in navigating the stormy trade waters.

The Federal Reserve left interest rates unchanged on Wednesday while painting an upbeat portrait of both the labor market and economy. The Fed indicated that the labor market has continued to strengthen, and economic activity has been rising at a strong rate.

Manufacturing payrolls rose by 37,000 jobs last month after increasing by 33,000 in June. Construction companies hired 19,000 more workers after increasing payrolls by 13,000 jobs in June. Retail payrolls rebounded by 7,100 jobs last month after losing 20,200 in June.

Government employment fell by 13,000 jobs in July. There were declines in transportation, utilities and financial payrolls last month.