One has performed much better than the other in the past year, but both Walmart (WMT -0.08%) and Target (TGT 0.18%) stocks have attractive qualities as long-term investments. The retailers are improving their profit margins right now, for example, and are boosting sales in a highly competitive industry. They each have increased their dividend payments for more than 50 consecutive years, too.

Let's look at a few reasons why you might choose one of these stocks over the other for your portfolio right now.

Walmart's growth is better

Investors were thrilled to learn that Target is expecting to return to growth in 2024 after a tough year of declines. The post-pandemic demand hangover hit the retailer hard because it sells a higher proportion of consumer discretionary products like home furnishings, while Walmart's focus on essentials protected it from the worst of that pullback. Comparable-store sales fell 4% at Target in 2023 and rose 6% at Walmart.

Customer traffic trends highlight that difference even more. Walmart handled 4% higher traffic this past quarter whereas Target's transactions dropped 2%. There's a good chance that Target will be ending its traffic slide over the next several quarters, yet Walmart is clearly the better choice for investors who prioritize growth and market-share gains.

Margins go to Target

Walmart is boosting profitability above the 3% rate that investors have seen for years, partly thanks to its push into areas like digital advertising and online pickup. You'll still prefer Target stock for its earnings power, though.

TGT Operating Margin (TTM) Chart

TGT Operating Margin (TTM) data by YCharts

It took several quarters of working through excess inventory, but Target is finally recovering the 6% operating profit margin that the business enjoyed in the pre-pandemic days. That's the rate investors saw before profitability spiked to nearly 10% and then collapsed during the subsequent growth hangover.

There are more gains to come. Target's 6% rate in the most recent quarter arrived amid declining customer traffic and falling sales, remember, and management is projecting an end to those pressures by late 2024. This gives the retailer the edge over Walmart when it comes to its potential to expand profit margins and annual earnings over the next several years.

Price and cash returns

The two retailers are both valued at 0.7 times annual earnings following Target's early-March stock-price spike. You might be tempted to pick Walmart in this situation if you're risk averse. The world's leading retailer has proven it can expand its business (and protect profit margins) in a tough selling environment. Its massive global sales footprint is another positive factor for the stock compared to Target's more volatile path to sustainable growth.

I like Target over its bigger rival here, though, for its improving growth trends and industry-leading margins. This past quarter's 2% customer traffic decline was a big upgrade over the prior three-month period's 5% slump and likely means a return to rising traffic on the way in 2024.

It will get much easier to boost annual earnings in that situation as well. Target is forecasting another earnings increase this year after last year's 50% surge. Given those positive factors, the stock has a good chance at moving toward its pre-pandemic valuation of closer to 1 times sales, likely translating into great returns for patient shareholders.