Wall Street closed out the week on a high, clinching its best levels of the year as confidence in the U.S. economy spiked.

A blowout jobs report calmed fears of weakness in the labor market, while assuring investors that the broader economy was on good footing heading into the back half of the year.

Since Tuesday, the S&P 500 rose 1.3%, the Dow Jones Industrial Average added 1.1%, and the Nasdaq gained 1.9%. Markets were closed on Monday in celebration of Independence Day.

Friday's gains pushed the S&P 500 and Dow to close at near record highs. The Dow recaptured a level above 18,000 earlier in the session. 

The U.S. nonfarm payrolls report showed that 287,000 jobs were added in June, well above economists' expectations of 175,000. The report was the best beat since December 2009. The 35,000 workers returning from a May strike at Verizon boosted the headline figure.

"This surprisingly strong job report will probably put a 2016 rate increase back into the conversation," said Chris Gaffney, president of EverBank World Markets.

A rate hike from the Federal Reserve in December, the meeting with the highest likelihood, now has a probability of 22.8%, according to CME Group Fed funds futures. The likelihood of a December rate hike was previously at 18.4%. The chances of a rate hike in July are virtually non-existent.

Worries over the timeline and execution of the Brexit made for rocky trading at the beginning of the week. Markets have been volatile after the June 23 vote as the pro-exit result blindsided global markets betting on the likelihood the U.K. would opt to remain in the EU. The results will have major political and economic implications for the region over the next two years and beyond as the country negotiates how exactly it will separate from the 28-nation bloc.

Dovish commentary from the U.K.'s central bank resurrected fears the Brexit would have a far worse impact on the global economy than the market reaction had accounted for. The Bank of England said Tuesday it would reduce the amount of capital banks need to hold to free up more money for lending to businesses and households. Bank of England Gov. Mark Carney said that the central bank has the scope to deal with Article 50, which will kick off Britain's exit, when it is invoked.

The Fed also appeared cautious in its June meeting minutes, released on Wednesday. The central bank said in June that it would be best to wait for more economic data and the results of the then-upcoming Brexit vote before adjusting monetary policy, according to minutes from last month's meeting.

Fed officials reiterated their criteria which would have to be met before materially changing policy: economic data confirming growth, sufficient and sustained job growth, and inflation heading toward the 2% target over the medium term.

Crude oil closed out Friday near two-month lows after a week in which rising domestic and global production kept pressure on commodities. A weekly read on active U.S. oil rigs showed an increase for the fifth week in six, while stockpiles fell at a far slower pace than expected in the past week. 

The commodity was also under pressure as Nigerian production rebounded in June, pushing total output from the Organization of Petroleum Exporting Countries to its highest level since January. A Bloomberg survey showed OPEC production increasing by 240,000 barrels a day in June. 

In earnings news, PepsiCo (PEP) - Get Report  beat quarterly estimates. The soda and snacks company earned an adjusted $1.35 a share in its second quarter, above estimates. Quarterly sales of $15.4 billion were in line with forecasts. PepsiCo expects share repurchases of $3 billion this fiscal year.

"We applaud Pepsi's results in this tough environment and appreciate the company's consistency and confidence in raising full-year guidance," said Jim Cramer and Jack Mohr from Action Alerts Plus, which holds PepsiCo. "We continue to like PEP as a long-term investment, especially given its 2.8%+ yield, strong brand names, and reliability in a market starved for yield and safety."