Much stronger-than-expected job gains in June helped set a more positive tone in early trading on Wall Street after many woke up to news that sniper killed five police officers and injured more during a Dallas protest over police brutality.

The Dow Jones Industrial Average rose 138.35, or 0.8 percent, to 18,034.23 shortly after the opening bell. The S&P 500 Retailing Industry Group increased 1.3 percent to 1,327.41.

Traders were heartened by word that the U.S. added 287,000 jobs last month — 107,000 more jobs than the 180,000 economists projected. The unemployment rate rose to 4.9 percent from 4.7 percent in May as more people sought to enter the labor force.

One of the strongest stocks at the open was Gap Inc., which jumped 6.6 percent to $23.06 after the firm said late Thursday that its June sales rose 2 percent to $1.57 billion. Gap’s comparable sales for June slipped 1 percent while Banana Republic comps declined 4 percent. Old Navy stood out with a 5 percent gain.

“We are pleased to see better performance across the portfolio this month, partly driven by an improvement in June traffic trends, particularly at Old Navy,” said Sabrina Simmons, chief financial officer at Gap Inc.

Among the other gainers were: Fossil Group Inc., up 4.1 percent to $29.44; Buckle Inc., 3.4 percent to $26.43; Ascena Retail Group Inc., 3.4 percent to $7.02; Nordstrom Inc., 3.4 percent to $40.45; Kate Spade & Co., 3.3 percent to $21.43; Abercrombie & Fitch Co., 3.3 percent to $18.83; Urban Outfitters Inc., 3.2 percent to $28.97, and Guess Inc., 3.2 percent to $15.17.

European stocks were also on the upswing.

The gainers included Marks and Spencer Group, ahead 5.1 percent to 3.14 pounds, or $4.07; Etam Developpement, 4 percent to 32.77 euros, or $36.21; Salvatore Ferragamo, 3.8 percent to 18.19 euros, or $20.10, and Tod’s, 3.2 percent to 47.48 euro, or $52.46.