WASHINGTON — A burst of hiring in June provided a reassuring sign that the U.S. economy will likely withstand global weakness that may be magnified by Britain’s decision to leave the European Union.

Last month’s gain — 287,000 jobs, the most since October 2015 — showed that employers shook off a hiring slump in April and May and suggested that the economy will continue to grow steadily.

May’s scant job gain of 11,000 and April’s modest 144,000 increase had raised fears that the job market was weakening after months of solid growth. The United Kingdom’s “Brexit” vote late last month to bolt the European Union escalated concerns that the global economy could slip into a recession and that the United States would be affected.

The June hiring figures, released Friday, were calculated before the Brexit vote. But the robust job growth served as a reminder that through much of the U.S. economy’s seven-year recovery from the Great Recession, it has repeatedly withstood crises and recessions overseas.

“We still rank among the best among the industrial economies,” said Patrick Newport, an economist at IHS Global Insight said. “We’re about the only ones doing OK right now.”

Investors registered their relief Friday by sending stock prices soaring. The Dow Jones industrial average closed up about 251 points, or 1.4 percent.