Target Corp.’s sales are on the rebound after falling for about a year.

The Minneapolis-based retailer revised its second-quarter guidance on Thursday, saying that traffic and sales had improved in May and June. So the company is now expecting a “modest increase” in comparable sales in the May-to-July quarter, a reversal from the single-digit decline it initially projected.

The company’s shares rose 5 percent on Thursday, as did some other retailers’ stocks upon the cheerier report amid an otherwise gloomy retail landscape.

The better-than-expected performance was not due to one category or product, but instead was across the board, said Target spokeswoman Katie Boylan.

“We’re seeing across the country — coast to coast — the business is doing well,” she said. “So it’s encouraging that it’s not isolated. We’re seeing it over time, across geographies and across the assortment.”

She added that the company is already seeing some of the benefits of its new strategic priorities executives laid out in February. Target is investing $7 billion into its business over the next three years to remodel 600 stores, including 110 this year; refresh its product lineup with a dozen new brands; and upgrade its technology and supply chain. The retailer also is taking a hit to its margins in order to lower prices.

Still, some analysts were cautious about the more upbeat forecast.

Chuck Grom, an analyst for Gordon Haskett, said in a research note that while the revised guidance was “encouraging,” it did not necessarily portend a major shift in momentum. Target’s original projection for lower sales just may have been too conservative, he said.

Oliver Chen, an analyst with Cowen & Co., said in a research note that his firm continues to favor Walmart, which it sees as better positioned to battle Amazon with some of its aggressive moves in e-commerce and pricing. But he said he’s becoming more positive on Target, especially given its improved sales and traffic.

“We like this momentum, but we do continue to see [Target] as a work in progress,” he said.

In a statement, CEO Brian Cornell said, “Target’s recent progress reinforces our confidence and commitment to our strategy as we build an even better Target for tomorrow.” The improved performance, he added, comes despite “continued challenges in the competitive environment.”

Cornell pointed to the May launch of a new nursery decor line, Cloud Island, as a success. He noted that four more new brands in home and apparel will hit the stores this fall.

Those new in-house brands are A New Day, a women’s apparel brand that will replace Merona and Mossimo; Goodfellow & Co., a new men’s clothing line; JoyLab, an athleisure brand; and Project 62, a new home brand.

He also said the company was “pleased” with the initial results of rollout in the Twin Cities of Target Restock, the next-day delivery service it recently began testing of household essentials, a rival program to Amazon’s Prime Pantry.

Target plans to report its full second-quarter results on Aug. 16.

On Thursday, Target also said it expects its earnings per share to be above the high end of its previous guidance because of a tax benefit from its global sourcing operations.

The retailer’s comparable sales have been in a slump, sliding the previous four quarters as consumers increasingly shop online and as Walmart and Amazon have been stepping up their games. Target’s grocery department has been a particularly weak spot and especially concerning to some analysts since Amazon is bolstering its efforts in that space with its recently announced acquisition of Whole Foods.

Given its challenges, Target executives dramatically walked back the company’s previous growth targets and told investors earlier this year not to expect sales to turn positive until 2018. They forecast a low-single digit decline in comparable sales for this year.

In May, Target reported a 1.3 percent drop in comparable sales in the first quarter of this year, which was better than the 3.6 percent decline analysts had forecast.