The S&P 500 notched its highest close in six weeks as investors parsed earnings reports to see how companies are managing inflation and supply-chain woes.

A handful of strong reports have helped calm fears of how badly those headwinds would affect corporate results, said Lamar Villere, portfolio manager at investment firm Villere & Co.

“I...

The S&P 500 notched its highest close in six weeks as investors parsed earnings reports to see how companies are managing inflation and supply-chain woes.

A handful of strong reports have helped calm fears of how badly those headwinds would affect corporate results, said Lamar Villere, portfolio manager at investment firm Villere & Co.

“I wouldn’t say the fog has been lifted or the fear is gone, but at least you’ve got some reasonably positive data points,” he said.

The S&P 500 gained 33.17 points, or 0.7%, to 4519.63, off 0.4% from its record hit in early September. The Dow Jones Industrial Average added 198.70 points, or 0.6% to 35457.31, its highest close in two months. The tech-heavy Nasdaq Composite rose 107.28 points, or 0.7%, to 15129.09.

Third-quarter earnings season is in its early days, with about 10% of S&P 500 companies having reported. Of those, roughly four out of five have beaten profit forecasts, according to FactSet.

Traders rewarded some of the companies that reported Tuesday. Shares of Johnson & Johnson rose $3.75, or 2.3%, to $163.87 after the company logged a larger profit in its third quarter than a year earlier, lifted by higher sales in its pharmaceutical, medical-device and consumer-health divisions.

Travelers shares climbed $2.51, or 1.6%, to $155.39 after the insurance company beat estimates for revenue and core income per share.

Procter & Gamble shares, meanwhile, fell $1.68, or 1.2%, to $140.66 after the consumer-product giant said it was raising prices on a host of household staples, as costs for freight and raw materials rose faster than anticipated.

Inflation is expected to be stickier than originally anticipated by central-bank officials, exacerbated by continued supply-chain disruptions, higher energy costs and labor shortages. Some investors expect supply problems will pinch companies’ sales.

“Will the market look through some of these supply constrained sales shortfalls?” said Andrew Slimmon, senior portfolio manager at Morgan Stanley Investment Management. “I think the market should, because I don’t think the consumer is going to walk away and not buy even if they have to wait a month or two.”

Ten of the 11 sectors in the S&P 500 advanced, led by the health care and utilities groups, while consumer discretionary stocks pulled back.

Bitcoin’s dollar value rose about 4.4% from its 5 p.m. ET level Monday, trading at $64,120.38 Tuesday. The first bitcoin-focused exchange-traded fund rose in its debut Tuesday. Cryptocurrency analysts said they will be watching to see how strong flows into the fund are, to assess whether the cryptocurrency’s recent price rally will hold.  

In bond markets, the yield on the benchmark 10-year U.S. Treasury note ticked up to 1.634% Tuesday from 1.583% Monday. Yields rise when bond prices fall. 

Fresh data showed that construction of new homes in the U.S. decreased in September after rising in August. Builders have been caught between strong demand from buyers—spurred in part by low interest rates—and shortages of materials, labor and lots.

Overseas, the pan-continental Stoxx Europe 600 rose 0.3%, while most major indexes in Asia closed higher. China’s Shanghai Composite gained 0.7%, and Hong Kong’s Hang Seng climbed 1.5%. South Korea’s Kospi and Japan’s Nikkei 225 each added about 0.7%.

Traders worked on the floor of the New York Stock Exchange on Monday.

Photo: BRENDAN MCDERMID/REUTERS

Write to Caitlin Ostroff at caitlin.ostroff@wsj.com and Karen Langley at karen.langley@wsj.com