Home Depot (HD -0.60%) and Target (TGT 0.70%) share the unenviable history of being victims of major security breaches that affected millions of their customers. But the similarities don't end there: They are also both big-box retailers that many retirees consider investing in given their dividend payments and lengthy operating histories.

Image source: Getty Images.

But which stock is the better buy today? There's no way to answer that question with 100% certainty, but there are three different approaches you can take, and each will help you make a more informed decision for your own retirement portfolio.

Financial fortitude

I won't blame you if you prefer to see most of the cash a company generates returned back to your account via dividends and share buybacks. But there's something to be said for keeping a hefty pile of cash around, too.

That's because every company will face tough times. Whether those times are company-specific or macro in their nature, the organizations that enter such periods with lots of cash and little debt often emerge stronger. They can outspend rivals, continue paying dividends, buy back shares on the cheap, or even acquire competitors.

Debt-heavy companies are in the opposite situation, forced to live and die by the whims of their creditors.

Here's how Target and Home Depot stack up in terms of financial fortitude.

Company

Cash

Debt

Net Income

Free Cash Flow

Target

$1.2 billion

$11.9 billion

$3.4 billion

$3.4 billion

Home Depot

$3.6 billion

$22.3 billion

$7.7 billion

$8.4 billion

Data source: Yahoo! Finance.

To be honest, I'm not a fan of either company's balance sheet. It's important to remember that Home Depot's valuation is over four times the size of Target's. While Home Depot has a slightly better cash-to-debt ratio, both companies have significant liabilities. While neither will have a tough time paying off these liabilities today, tough times could create a serious squeeze.

Target appears to have superior cash flow, relative to its market cap. Based on this alone, I'm willing to go with Target on this variable.

Winner: Target

Sustainable competitive advantages

I've learned in my own investing career that there's nothing you should spend more time evaluating that a company's sustainable competitive advantage -- often referred to as a "moat." The simplest way to define a moat is that it's that special something that makes a company stand out from the crowd -- and keeps customers coming back year after year, decade after decade.

Target's key moat is provided by its brand. The company benefits from economies of scale -- but so do most of its biggest rivals. To differentiate itself, Target has taken up a place for middle-income shoppers, sitting somewhere between Wal-Mart on the low end and pricier retailers on the other.

The problem is that these very same customers -- the middle tier -- are the ones that have been migrating in droves to e-commerce. Amazon.com has taken a huge chunk out of Target's potential business over the past decade. And while I don't see the company fading into oblivion, I don't see how it can offer anywhere near the convenience Amazon does.

Home Depot, on the other hand, benefits from the fact that it offers home improvement goods that clients both (1) want to see, touch, and play with before purchasing, and (2) want to walk out of the store with and use immediately.

As half of the American duopoly in this industry -- and owner of the largest market share -- the company has a leg up on Target, as its moat is demonstrably wider.

Winner: Home Depot

Valuation

Finally, you can look at valuation. While this isn't an exact science, there are some straightforward metrics you can consult to give you an idea of how expensive each stock is.

Company

P/E

P/FCF

PEG Ratio

Dividend

FCF Payout Ratio

Target

13

11

2.2

3.4%

40%

Home Depot

22

20

1.6

2%

40%

Data sources: Yahoo! Finance, E*Trade. Nasdaq.com. P/E represents figures from non-GAAP (adjusted) earnings.

On the face of it, Target appears to be the much cheaper stock -- as it trades for lower earnings ratios and has a higher dividend.

But when it comes to the price/earnings-to-growth (PEG) ratio -- which takes the potential for future growth into consideration -- it appears that Home Depot is trading for a 27% discount. That's because of the aforementioned moat: Analysts know that Home Depot still has pricing power and market share to grab, while Target has to deal with lagging sales in the face of a mammoth e-commerce threat.

Given that fact, I think this category is essentially a tie.

Winner: Tie

And the winner is...

So there you have it: It's a draw. If I absolutely had to choose one, I would definitely go with Home Depot. Don't get me wrong -- financial fortitude and valuation are both important, but at the end of the day, I think a company's moat reigns supreme. And on that measure, Home Depot definitely has the advantage.