Stocks rose on Monday, recovering losses from earlier in the session as oil dipped despite rising geopolitical worries following last week's U.S. killing of Iran's top general.

The Dow Jones Industrial Average ended the day up 68.50 points, or 0.2% at 28,703.38 after falling 216 points earlier in the day. The S&P 500 closed 0.4% higher at 3,246.28 while the Nasdaq Composite advanced 0.6% to 9,071.46.

Big tech stocks led the gains. Facebook and Amazon both rose more than 1%, and Netflix and Google-parent Alphabet advanced 3.1% and 2.7%, respectively.

Monday's gains were in contrast to Friday's sharp decline. The Dow and S&P 500 had their worst trading day in a month on Friday, the morning after President Donald Trump approved a U.S. airstrike in Baghdad that killed top Iranian Gen. Qasem Soleimani.

"If you were looking for a reason to sell, you got one," said Art Hogan, chief market strategist at National Securities. "But the fundamental backdrop hasn't changed in front of our eyes."

"The market has done exactly what it should do," he added.

The news sparked a bid on oil prices amid worries the conflict could disrupt the world's oil supply. Crude rallied more than 3% on Friday to its highest level since April. Oil briefly rose 2% earlier in Monday's session before settling little changed.