Stocks added to gains on Friday as oil and energy names distracted from worries over the U.S.'s role in the Syrian conflict and a disappointing jobs number for March.

The S&P 500 was up 0.2%, the Dow Jones Industrial Average added 0.27%, and the Nasdaq gained 0.18%. Stocks were lower earlier and have wavered around the flatline since. 

Crude oil rose nearly 1% as investors poured money into safe-haven assets. West Texas Intermediate crude oil, the U.S. benchmark, rose 1% Friday to $52.21 a barrel, coming off earlier highs.

Crude oil prices held higher after another increase in drilling activity in the U.S. The number of active drilling rigs climbed by 15 to 839 in the past week, according to Baker Hughes. Oil rigs increased by 10 to 672. The U.S. rig count has increased for the past 12 weeks in a row.

Energy names were among the best performers on markets Friday. Royal Dutch Shell (RDS.A - Get Report) , BP (BP - Get Report) , China Petroleum (SNP - Get Report) , and Petrobras (PBR - Get Report) moved higher, while the Energy Select Sector SPDR ETF (XLE - Get Report) added 0.2%. 

The U.S. economy added just 98,000 jobs in March, the smallest increase in nearly a year and well below estimates of 180,000, according to economists surveyed by FactSet. The construction sector was partly to blame, adding only 6,000 new jobs largely due to a late-season snow storm. Ameriprise Financial senior economist Russell Price estimated that severe weather likely reduced the headline number by 75,000 to 100,000. 

February and January numbers were also revised lower. The February figure was cut to 219,000 jobs added from 235,000, while January was decreased to 216,000 from 238,000. The unemployment rate unexpectedly fell to 4.5% from 4.7%. Average hourly wages increased 0.2% to $26.14. The participation rate remained at 63%. 

(What will move markets this quarter and how should investors position themselves ahead of time? Jim Cramer sat down with four of TheStreet's top columnists recently to get their views. Click here to listen to his latest Trading Strategies roundtable with them and read their advice for stocks, bonds, forex and gold).

"The deceleration in March will disappoint, but this signals more room for the expansion to run," Bodhi Ganguli, lead economist at Dun & Bradstreet, wrote in a note. "Markets are likely to react negatively, as they were already roiled by news from Syria, and will now turn their focus to President Trump's meetings with the Chinese president to look for further clues on U.S. trade and geopolitical positions."

Safe-haven assets rallied overnight, while stock futures initially plummeted, after the U.S. launched missile strikes against a Syrian air base. Around 60 cruise missiles were launched at the al-Shayrat airfield, identified by the U.S. as the base from which a chemical attack was launched earlier this week. The attack by American destroyers USS Ross and Porter was the first time the U.S. has directly intervened in Syria's long-running civil war

The attack was a reversal for the Trump administration which had previously leaned toward a non-interventionist approach to the Syrian civil war. Wall Street grew nervous on Thursday afternoon after Donald Trump and Secretary of State Rex Tillerson signaled possible military action in Syria. Tillerson said the U.S. was considering the "appropriate response" to the chemical attack in Syria on Tuesday that killed dozens. Trump said "something should happen" in Syria regarding President Bashar al-Assad's leadership. The attacks could also cause rifts with Russia, which supports the Assad regime.

 The U.S. dollar had initially declined against a range of international currencies, though pared losses. Gold prices increased 1.1% to $1,267.20 an ounce

"Investors buy gold when they sense danger because gold has an impressive record of preserving wealth through economic depressions, stock-market crashes and every other type of financial or monetary crisis," said David Yoe Williams, principal at Strategic Gold, in the latest Trading Strategies series

Defense stocks saw some of this biggest gains of the day. Boeing (BA - Get Report)  , Northrop Grumman (NOC) and Lockheed Martin (LMT - Get Report) moved higher, while Raytheon (RTN - Get Report) , the maker of the Tomahawk missiles used in the attack on Syria, added more than 1%. 

A suspected terror attack in Sweden also kept markets on edge. At least two people in Stockholm were reportedly dead after a truck plowed into a crowd. Swedish Prime Minister Stefan Lofven said the attack appeared to be an act of terrorism. 

Trump and China's President Xi Jinping met for day two of a summit at Mar-a-Lago in Florida in what are expected to be a highly charged discussions. Trump said Thursday night that the two had had a "long discussion already" and said that they had "developed a friendship."

Trump had been highly critical of China on the campaign trail and since taking office, accusing the country of currency manipulation and stealing U.S. jobs. Trump had previously proposed a high tariff on U.S. imports of Chinese-made products. North Korea also will presumably be an important topic of conversation.

The Federal Reserve rattled nerves earlier in the week after signaling further monetary tightening this year. The Fed could reduce its balance sheet during its March meeting, including the possibility of ending its policy of reinvesting principal payments. Reducing the balance sheet could have the same impact on the markets as a rate hike. The central bank raised rates in March for the third time since 2008. 

"The Federal Reserve's March rate hike has awakened central banks around the world, with most eager to follow the Fed's lead by either raising their own rates or curtailing local versions of quantitative easing," said Douglas Borthwick, managing director of Chapdelaine FX

PriceSmart  (PSMT - Get Report) fell 2% after quarterly earnings missed estimates. Second-quarter earnings of 90 cents a share fell short by 2 cents, while revenue of $772.3 million missed consensus of $794.4 million.  

Twitter (TWTR - Get Report)   has pulled its lawsuit against the U.S. government after officials withdrew a summons to identify users behind accounts opposed to the Trump administration. The social network had filed the lawsuit following a U.S. government request for records. Twitter had said their efforts to "unmask" the people behind the account violate the First Amendment.

21st Century Fox (FOXA) received approval from the European Union for its $14.3 billion deal to purchase a large stake in Sky. Fox received regulatory approval to purchase the 61% stake in the British TV station that it doesn't currently hold. Fox still needs to receive approval from U.K. officials. 

Related News From the Street: