NATIONWIDE — The stock market is not the economy.

Rarely has that adage been as clear as it is now. An amazing, monthslong rally means the S&P 500 is roughly back to where it was before the coronavirus slammed the U.S, even though millions of workers are still getting unemployment benefits and businesses continue to shutter across the country.

The S&P 500, which is the benchmark index for stock funds at the heart of many 401(k) accounts, ended Wednesday at 3,380.35 after briefly topping its closing record of 3,386.15 set on Feb. 19. It’s erased nearly all of the 34% plunge from February into March in less time than it takes a baby to learn how to crawl.

The U.S. and global economies have shown some improvements since the spring, when business lockdowns were widespread, but they are nowhere close to fully healed. The number of virus cases continues to rise across much of the United States, and federal and local politicians for the most part lack a strategy to contain it. Many industries, such as airlines, hotels and dining, could take years to recover from the damage.

The Federal Reserve and the U.S. government get a lot of the credit for the rally after pouring trillions of dollars into the economy. Profits also remained incredibly resilient for the stock market’s most influential companies, such as Apple and Amazon. Rising hopes for a potential vaccine to halt the pandemic, meanwhile, have encouraged investors to look past the current dreary statistics.

Here’s a look at how Wall Street has flourished while Main Street struggles:

THE MARKET’S BIG GUNS

The corner bars, the family restaurants, the hair salons and other small businesses across the U.S. that are teetering or closing for good aren’t listed on the stock market. Apple, Microsoft, Amazon, Facebook and Google’s parent company are, and movements in their stocks alone are dictating the action in the S&P 500 more than ever before.

The pandemic has accelerated work-at-home and other trends that have boosted Big Tech, and their profits are piling up. The five big tech-oriented giants are now worth a combined $7.6 trillion, and by themselves account for more than 22% of the S&P 500′s total value.

Because stocks with the biggest market values carry the most weight in the S&P 500, the movements of Big Tech matter much more than what airlines, cruise-ship operators or other still-struggling companies are doing. American Airlines is down more than 50% for 2020 so far, but its much smaller market value means it doesn’t move the needle like Big Tech. It would take 280 American Airlines to have the heft of one Apple.

The stock market has seen some broadening out of gains recently, with stocks of smaller companies doing better. But Big Tech has done the heaviest lifting in the S&P 500′s rally.

HELP FROM WASHINGTON

A famous saying on Wall Street is: Don’t fight the Fed. The central bank is doing everything it can to support the economy, from cutting interest rates to nearly zero to the unprecedented promise to buy even riskier corporate debt. It’s all aimed at ensuring lending markets have enough cash to run smoothly and to prevent prices from going haywire. Economists say the moves have helped avoid a 2008-09 style meltdown of the financial system.

The Fed has signaled that it will keep its benchmark short-term interest rate at nearly zero through at least 2022, and low rates are often like steroids for stocks. With Treasurys and other bonds paying relatively little in interest, some investors are turning instead to stocks, gold and other investments, boosting their prices.

Congress also approved an unprecedented amount of aid for the economy. Some portions of that aid have already expired, and another economic relief package is tied up in partisan rancor on Capitol Hill. But many investors seem to expect Washington to eventually come to a compromise and throw another lifeline to the economy.

Meanwhile, the economy is recovering but at a much slower pace than its rapid collapse in the spring. After shrinking at an annual pace of 32.9% in the April-June quarter, economists forecast it will rebound at a 20% annual pace in the July-September period. The unemployment rate is 10.2% and is expected to remain in the high single-digits through at least the end of this year.

THE NATURE OF THE MARKET

Investors are setting stock prices now based on where they see corporate profits heading in the future. And for many on Wall Street, the future looks brighter than the bleak present, in large part because of hopes that a vaccine for the new coronavirus could help things get back to normal.

“Main Street is the now, Wall Street is the future,” said Sam Stovall, chief investment strategist at CFRA Research.

Companies have begun final-stage testing of potential vaccines for COVID-19, and many investors are hopeful that something could be available either late in 2020 or within a year. A return to normal could help the economy get back on track and perhaps boost profits back to record levels. Stock prices tend to track with corporate earnings over the long term.

The same look-ahead mentality sent the stock market tumbling severely earlier this year, before the worst of the recession arrived. Stocks began falling in late February, a month before the number of layoffs began exploding, for example. The S&P 500 hit what turned out to be its low point on March 23, the same week that the government reported a record number of U.S. workers filed for unemployment benefits, nearly 6.9 million.

“Wall Street continues to look six to nine months down the road,” Stovall said.

Of course, many risks still remain for the market despite all its ebullience.

For all of Wall Street’s optimism, talks in Washington on more stimulus could break apart and deprive the economy of the aid investors say it crucially needs.

Rising tensions between the United States and China are also hanging over the market. The world’s two largest economies have longstanding trade issues, and the United States has recently been cranking up the pressure on Chinese technology companies.

And the virus remains the ultimate wild card. If a vaccine doesn’t hit the market within the next year, all the hope that has helped build up Wall Street’s rally could quickly vanish.