By Sarah Nassauer and Suzanne Kapner

The coronavirus pandemic has widened the gap between retail's winners and losers, boosting the fortunes of big U.S. chains that were able to stay open throughout the pandemic and feed America's basic needs.

The evidence was stark this week as national retailers revealed they were exiting the summer months heading in different directions. On Wednesday, Target Corp. and Lowe's Cos. reported the strongest quarterly sales growth in their histories. Meanwhile, chains like Kohl's Corp. and T.J. Maxx that had to temporarily shut their doors posted sharp sales declines.

Like rival Walmart Inc., Target has benefited as coronavirus concerns fueled demand for services that let shoppers pick up goods in parking lots or skip trips to the store. Both companies also sell groceries and other household staples that have been in demand as Americans cook and clean more in their homes.

Target executives cited broad gains across categories such as food, electronics and home goods and a rebound in clothing sales in the quarter ended Aug. 1. "In the current environment, each of our categories are performing very well," Chief Executive Brian Cornell said on a call with reporters.

Target's online sales nearly tripled from a year ago. Walmart, which is a global retailer and much larger in terms of revenue, said its U.S. e-commerce revenue nearly doubled in the latest quarter.

On the flip side, TJX Cos., the parent of off-price chains T.J. Maxx, HomeGoods and Marshalls, said quarterly sales fell 32% as its stores were closed for nearly a third of the quarter due to the Covid-19 pandemic. L Brands Inc., whose Victoria's Secret and Bath & Body Works stores were shut for much of the quarter, posted a 20% drop in quarterly sales.

Shares of Target jumped more than 12% in Wednesday trading to new highs, while TJX shares slid 5%. Shares of Walmart, Lowe's and L Brands were little changed.

Government stimulus checks and extra unemployment benefits helped the locations that were open. Executives at several companies told investors that sales growth has slowed in recent weeks as those benefits were reduced.

U.S. consumer retail spending collapsed in March and April, when restrictions to stem the spread of Covid-19 required many stores to shut. Government data have since recorded three straight months of spending gains at restaurants and stores as many businesses reopened.

Big chains such as Target, Walmart and home-improvement chains, along with e-commerce giant Amazon.com Inc., have been among the biggest beneficiaries of new shopping habits and increased spending on homes and food. Home Depot Inc. said U.S. comparable sales rose 25%, while Lowe's posted a 35% jump.

Walmart's U.S. comparable sales rose 9.3% in the most recent quarter, bringing its global revenue to $137.7 billion. Target said its comparable sales jumped 24% and total revenue reached $22.9 billion in the quarter. Profits were also ahead of Wall Street's expectations at both companies.

Smaller chains and traditional department stores, many forced to close during the early days of the pandemic, aren't faring well. Lord & Taylor, J.C. Penney Co. and Stage Stores Inc. have all filed for bankruptcy protection since May. Last week, off-price chain Stein Mart Inc. filed for chapter 11 with plans to close most of its roughly 280 stores.

L Brands said on average its Victoria's Secret's stores were closed for about 70% of the quarter, while its Bath & Body Works chain was closed for about half the quarter. It has since reopened most of its North American stores, though in some virus hot spots they are only open for curbside services.

TJX, which has limited e-commerce operations, struggled to stock enough goods after an initial surge of shoppers when it reopened many of its closed stores. The company said it has reopened more than 4,500 stores world-wide.

The company had planned lower inventory levels to facilitate social distancing, but sold more than expected at reopened stores and encountered supply-chain and logistics challenges as operations ramped up, CEO Ernie Herrman told analysts on Wednesday. He added that the retailer has had trouble getting products in some hot categories, such as items for the home.

TJX said traffic and sales moderated as it moved into August due to consumer behavior and demand related to Covid-19, as well as lighter inventories in stores than planned. Mr. Herrman said some consumers just aren't comfortable going to bricks-and-mortar stores for nonessential items.

Retail executives said they are unable to forecast demand heading into the critical holiday shopping season. "There are many potential challenges on the horizon, including uncertainties surrounding COVID-19, economic headwinds from historically high unemployment, uncertainty surrounding government stimulus and a contentious November election," Target's finance chief Michael Fiddelke said Wednesday. Predicting financial metrics "is an exercise in imprecision at this point."

Target said it plans to lengthen the traditional back-to-school shopping season, making school supplies available throughout the fall. It said it thinks around two-thirds of American students are starting the year learning online without clarity on when in-classroom lessons will resume.

It is also planning for an extended and unpredictable holiday shopping season, with more online shopping that past years, said Mr. Cornell, the Target CEO. "We're certainly preparing to start earlier than ever before in the October period," he said.

Write to Sarah Nassauer at sarah.nassauer@wsj.com and Suzanne Kapner at Suzanne.Kapner@wsj.com

Corrections & Amplifications

This article was corrected at 8:11 p.m. ET to reflect that Lowe's Cos. reported the strongest sales growth in decades. The original version of this article incorrectly said in the second paragraph that the company reported the strongest sales growth in its history.