"If you took a week off, you probably thought you didn't miss much, because we're at about the same levels today as we were last Friday," said Sean Lynch, co-head of global equity strategy at Wells Fargo Investment Institute. "And yet, we spiked to a new all-time high on the S&P on Monday, we suffered the worst decline of the year on Wednesday, and again we're back within 1 percent of that all-time high today."
The S&P 500 index rose 16.01 points, or 0.7 percent, to 2,381.73. The Dow Jones industrial average added 141.82 points, or 0.7 percent, to 20,804.84. The Nasdaq composite index gained 28.57 points, or 0.5 percent, to 6,083.70. The Russell 2000 index of smaller stocks picked up 6.25 points, or 0.5 percent, to 1,367.33.
Four stocks rose for every one that fell on the New York Stock Exchange. Still, indexes ended the week lower.
Bond prices edged lower. The 10-year Treasury yield rose to 2.24 percent from 2.23 percent late Thursday.
Investors had grown concerned Wednesday that President Donald Trump's pro-business agenda could be hindered by fallout from allegations that he asked the FBI to end an investigation into former National Security Adviser Michael Flynn, sparking the steep sell-off.
But they remained in a buying mood Friday, nudging U.S. stock indexes higher early on, extending modest gains from the day before.
"It's clearly been a roller coaster week, with equities being swayed between political uncertainty and improving fundamentals," said Terry Sandven, chief equity strategist at U.S. Bank Wealth Management. Despite the tumult in Washington, "President Trump's pro-growth agenda of tax reform, less regulation, infrastructure spend and the like, in our view, still remain drivers of higher stock prices."
Traders bid up shares in several companies like Deere & Co. that reported solid quarterly results Friday.
The heavy equipment maker's shares jumped $8.23, or 7.3 percent, to $120.90.
Autodesk vaulted 14.7 percent after the design software company raised its earnings forecast for the year and reported a loss in its latest quarter that was narrower than analysts were expecting. The stock was the biggest gainer in the S&P 500, adding $14.08 to $109.91.
McKesson jumped 8.2 percent after the prescription drug distributor reported earnings for its latest quarter that easily beat Wall Street's forecasts. Its shares gained $11.57 to $153.01.
Ross Stores rose 1.9 percent after the discount retailer also reported quarterly results that beat Wall Street's estimates. The stock picked up $1.13 to $62.20.
Some companies turned in disappointing results.
Foot Locker plunged 16.7 percent after the athletic footwear and apparel retailer's latest quarterly profits fell short of analysts' forecasts. The stock was the biggest decliner in the S&P 500, shedding $11.73 to $58.72.