The gains helped major averages erase the week's losses as buying intensified as the day came to a close. The CBOE market volatility index fell 5.7 per cent to 15.71 in a sign of reduced investor uncertainty.
Stocks have been under pressure of late as investors, worried about high valuations and uncertainty around the world, pulled back from riskier assets. Before Friday's rally, the S&P 500 had given up more than four per cent while the small-cap Russell was down seven per cent over the past four weeks.
Markets rallied after Russia's Defense Ministry said Friday it had finished military exercises in southern Russia, which the United States had criticised as a provocative step amid the Ukraine crisis.
"The market hates uncertainty, and when it doesn't have enough information about how badly an event could impact the economy, it tends to take the worst-case scenario and people sell off," said Malcolm Polley, president and chief investment officer of Stewart Capital Advisors in Indiana, Pennsylvania.
Earlier on Friday, the United States carried out air strikes targeting Islamic State fighters marching on Iraq's Kurdish capital.
The strikes were the first authorised on Iraq since President Barack Obama pulled American troops out in 2011.