U.S. stocks rose Friday, putting major indexes on track for weekly gains after a string of strong earnings reports bolstered investor confidence following a bout of market volatility.

The S&P 500 climbed 0.4%, pushing the broad market gauge to a 1.3% jump for the week, despite the steep fall that the index suffered on Monday. The Dow Jones Industrial Average added about 125 points, or 0.4%. The Nasdaq Composite gained 0.3%. All three indexes are hovering near all-time highs.

The monthslong rally in stocks has resumed after markets skidded at the start of the week in response to concerns about the fast-spreading Delta variant. Investors have drawn comfort from rapid earnings growth at the biggest American companies. Money managers also say governments in the U.S. and Europe are unlikely to bring in lockdowns that restrict growth, even if rising cases take the shine off the economic recovery.

“You have an earnings season that is going tremendously well,” said Seema Shah, chief strategist at Principal Global Investors. The economic outlook isn’t as strong as it was three months ago, but “the path ahead is not that negative and certainly there is a lot of buying the dip,” she added.

Ms. Shah is keeping a close eye on what executives are saying about their ability to pass higher input costs to customers instead of taking the hit in profit margins. The flip side: If many companies succeed in feeding costs through, inflation will take longer to subside, which could prompt concerns about higher interest rates and knock the market.

Among individual stocks, Snap leapt 25% on revenue that more than doubled in the second quarter and the fastest user growth in four years. American Express gained 4.5% on forecast-beating earnings and revenue as spending accelerated in the three months through June.

Twitter shares rose 1% after the social-media company reported a 74% increase in revenue in the second quarter compared with a year before. Intel’s stock fell 4.9% after Chief Executive Pat Gelsinger said he sees the global semiconductor shortage potentially stretching into 2023.

Of the roughly 110 companies in the S&P 500 that had posted results through Thursday for the second quarter, 85% topped analysts’ profit forecasts, according to FactSet.

TAL Education Group shares, listed in New York, plunged 56% on fears of a Chinese government crackdown on the for-profit education sector, and after-school tutoring in particular. An unverified document, circulating among investors and seen by The Wall Street Journal, appeared to be an official communication detailing tougher guidelines. Analysts at Jefferies say investors have grown worried about the outlook for after-school tutoring, and are concerned it may have to be done on a nonprofit basis.

Other Chinese education companies also took a hit. American depositary receipts of Beijing-based 17 Education & Technology Group slumped 41%.

In the bond market, the yield on 10-year Treasury notes ticked up to 1.308% from 1.264% Thursday. Yields move in the opposite direction to bond prices, and have recovered all their lost ground after sliding Monday.

“This was always going to be a difficult moment when we move from that [economic] rebound to normal rates of growth,” said Paul Jackson, head of asset allocation research at Invesco. “So I suspect the markets will continue to trend higher, but we will get these little pockets of volatility.”

Oil prices wavered between small gains and losses. Futures for West Texas Intermediate, the main grade of U.S. crude, slipped 0.4% to $71.62 a barrel.

A trader worked on the floor of the New York Stock Exchange on Wednesday.

A trader worked on the floor of the New York Stock Exchange on Wednesday.

Photo: brendan mcdermid/Reuters

In overseas markets, the Stoxx Europe 600 rose 1%, buoyed by shares of car and car-part makers, as well as commodities producers.

In Asia, Japan’s stock market was closed due to a national holiday. China’s Shanghai Composite fell 0.7% by the end of trading, while Hong Kong’s Hang Seng Index dropped 1.5%.

Caitlin McCabe contributed to this article.

Write to Joe Wallace at Joe.Wallace@wsj.com