Wall Street bagged its best August in more than 30 years on Monday, a month that saw the three major U.S. indexes notch new milestones as investors looked past the pandemic and kept focus on positive economic markers.

Trading was mixed, with the Standard & Poor’s 500-stock index slipping 0.2 percent, to 3,500.31, and the Dow Jones industrial average falling 0.8 percent, to 28,430.05. The broad S&P 500 index closed out the month 7 percent ahead — its best August since 1986 — and set record highs the past six trading days.

Buoyed by high-performing tech companies, the Nasdaq composite index swelled 0.7 percent, to 11,775.46. It added 9.6 percent during the month.

Improving labor data and the Federal Reserve’s moves toward looser monetary policy have fueled optimism on Wall Street, even as the wait continues for a coronavirus vaccine and a full economic recovery. The three major U.S. indexes have erased all of their losses for the year, wiping out the devastating plunge in stock prices triggered by the spread of the coronavirus in March and putting an end to the shortest bear market in U.S. history.

Stocks may have snapped back, but the labor market remains deeply scarred. On Thursday, the Labor Department said another 1 million Americans filed jobless claims last week. Approximately 27 million are receiving some form of unemployment aid, as many of the temporary job losses turned permanent. Last week, a half-dozen major companies announced layoffs, including Coca-Cola, Salesforce, American Airlines, Bed Bath & Beyond and MGM Resorts.

Investors are monitoring how the expiration of coronavirus-related aid, such as the $1,200 stimulus checks and $600 in enhanced weekly unemployment benefits, will cascade through the economy’s lower rungs. Hunger rates are hovering near record levels, while the end of the federal eviction moratorium has left many households in crisis, yet there are no new lifelines in sight for lower-income Americans.

“As some of the fiscal measures put in place begin to wear off, the need for additional fiscal stimulus only increases,” Charlie Ripley, senior investment strategist for Allianz Investment Management, wrote in a note on Monday. “At the end of the day, the speed of the recovery rests in the hands of politicians as they wrangle over the details in the next round of fiscal stimulus spending.”

Wayne Wicker, chief investment officer at Vantagepoint Funds, said as long as the economic data continues to improve and companies don’t see a major impact on their bottom lines, then the markets will be satisfied.

“Wall Street and Main Street have a very different perception of the future right now,” Wicker said.

For the approximately half of Americans who own stocks — especially the everyday investors whose money is largely tied to 401(k)s and other retirement accounts — Wall Street’s roaring comeback has led to fatter portfolios.

Fidelity, the nation’s largest provider of 401(k)s, reported earlier this month that the vast majority of employers continued offering matching contributions to workplace retirement accounts during the pandemic. Workers are plowing money away at record levels: Year-to-date contributions to individual retirement accounts jumped more than 20 percent compared with last year, Fidelity said, with the average balance sitting at $111,500, a 13 percent increase from last quarter. Nearly 90 percent of all 401(k) holders continued saving for retirement and nearly 1 in 10 upped their contribution rate in the past three months.

The S&P 500 notched seven record highs in August, its fifth consecutive month of gains. But the dramatic rebound is hitched to the dominance of the tech giants, whose gargantuan market valuations have given them outsize influence on Wall Street. A handful of technology companies — Netflix, Microsoft, Facebook, Alphabet, Amazon and Apple — account for more than one-quarter of the S&P’s value. In fact, without them, the index would still be in negative territory.

The last day of August also marked the first day of trading for the newly reconfigured Dow. The index, which tracks 30 large publicly traded companies, swapped out three companies. Oil giant ExxonMobil, pharmaceutical company Pfizer, and aerospace and defense manufacturer Raytheon Technologies were replaced by Salesforce, a cloud-computing company; Amgen, a biotechnology firm; and Honeywell International, an aerospace and industrial manufacturer.

The Dow shake-up was designed to offset the impact of Apple’s stock split, which would have diminished the technology sector’s representation in the index. The new lineup is meant to reflect tech’s growing sway and market leadership in the country. The Dow is within a few percentage points of its record high of 29,551.42, set Feb. 12.

Monday was the first trading session to include Apple’s stock split. Tesla, another company whose stock price has surged this year, has also split its stock, which took effect in the morning.

The pandemic and the election leave room for more shocks to the market, said Ryan Detrick, chief market strategist for LPL Financial, especially during a historically tough month for stocks.

“Well, 2020 has laughed at many of these things, but be aware September is indeed the worst month of the year on average,” he said in a research note Monday, explaining September’s tendency for weak returns. “But what caught our attention was both September and October have a negative return during election years, with October the worst month of the year.”