All main U.S. stock indexes closed higher on Tuesday, with the Dow finishing at its 47th record for 2017, as optimism appeared to grow ahead of the start of the earnings season, which will provide concrete insight into the state of U.S. corporations.

What are stocks doing?

The Dow Jones Industrial Average DJIA, -0.87% rose 69.61 points, or 0.3%, to end at 22,830.68. The S&P 500 SPX, -1.11% added 5.91 points, or 0.2%, to close at 2,550.64. The Nasdaq Composite Index COMP, -1.07% reversed earlier losses to finish 7.52 points, or 0.1%, higher at 6,587.25.

All three benchmarks touched fresh intraday peaks during the session. Highlighting a recent uptrend in equities, the S&P 500 has risen in nine of the past 11 sessions and the Nasdaq has gained in 10 of the past 11.

Consumer staples, among the best gaining sectors, were buoyed by Wal-Mart Stores Inc. WMT, -1.02% , which at an investor meeting said it would continue its strategy of focusing on domestic existing stores and e-commerce growth to boost sales. It also announced a $20 billion share repurchase program. The stock surged 4.5% and was one of the biggest boosts on the Dow.

What are market participants saying?

“We think valuations are fair and we’re not expecting any big surprises out of earnings season, which should be pretty strong,” said Michael Matousek, head trader at U.S. Global Investors Inc. in San Antonio. “I don’t think we’re going to see major moves to the upside or the downside until earnings, because people are waiting to see where major companies like [Facebook Inc.] FB, -0.89% come in, but there is optimism.”

This week, investors are likely to focus on two main events—the release of the FOMC’s minutes from its September meeting and the launch of third-quarter earnings season, according to Kent Engelke, chief economic strategist at Capitol Securities Management Inc.

If the minutes strike a more hawkish tone than expected, market’s volatility is likely to rise in response, said Engelke.

The central bank last month announced that it would began to unwind its $4.5 trillion balance sheet starting this month. “QE fundamentally changed the markets,” he said.

What could move the markets?

Buying sentiment could be dampened ahead of the start of earnings season which kicks off in earnest on Wednesday with reports from BlackRock Inc. BLK, +1.55% and Delta Air Lines Inc. DAL, -3.29% . J.P. Morgan Chase & Co. JPM, -0.21% and Citigroup Inc. C, -1.47% will report Thursday, followed by Bank of America Corp. BAC, -0.55% and Wells Fargo & Co. WFC, +0.08% on Friday.

Engelke expects another better-than-projected quarter of earnings as “Corporate America and analysts alike have been under promising and over delivering forever.”

Read more:Third-quarter earnings seen as ‘an easy beat,’ could set up more stock market records

The International Monetary Fund lifted its forecast for global growth but also warned of downside risks going forward. The IMF called on China to take more step to curb its credit growth, and for a “concentrated effort” to clean up the balance sheets of European banks.

In the latest economic data, sentiment among small-business owners stumbled in September as expectations for sales and economic growth plunged.

Which stocks are in focus?

Procter & Gamble Co. PG, -0.10% shares fell 0.5%. At the annual general meeting on Tuesday, a proxy vote among shareholders resulted in all of the company’s directors being re-elected, meaning that activist investor Nelson Peltz wasn’t named a director.

Nvidia Corp. NVDA, -2.20% rose 1.9% after the graphics chip maker unveiled new hardware to be used in self-driving taxis. The stock, which has nearly tripled over the past 12 months, hit an all-time high.

KalVista Pharmaceuticals Inc. KALV, +2.98% surged 39% after Merck & Co. MRK, +0.19% bought a 9.9% ownership stake in the company, paying $8.50 a share. The stock closed Monday at $7.35. Merck shares edged up 0.2%.

Express Scripts US:ESRX said it would buy the privately held EviCore for $3.6 billion. Shares fell 1.8%.

Wal-Mart’s shares marked their highest close since Feb. 2, 2015 and its largest single-day gain since May 19, 2016, according to WSJ Market Data Group.

What are other assets doing?

European stocks SXXP, -2.73% finished mostly lower, with Spain’s IBEX benchmark IBEX, -3.46% slipping. Catalan President Carles Puigdemont said he is “accepting the mandate” of the Oct. 1 referendum on Catalonia’s secession from Spain but won’t declare independence in favor of dialogue with the central government.

Asian markets traded mostly higher.

Oil futures US:CLX7 jumped and gold futures US:GCZ7 settled higher.

Read:OPEC urges U.S. shale to take ‘shared responsibility’ to cut oil output

The ICE U.S. Dollar Index DXY, +0.47% was down 0.5% as the dollar fell against the euro EURUSD, -0.60% , the British pound GBPUSD, -0.55% and the yen USDJPY, -0.41% .

Wal-Mart debuts 30-second returns in stores to rival Amazon

—Barbara Kollmeyer contributed to this article.