Costco (COST 1.07%) and Kroger (KR 0.96%) have both delighted shareholders recently by posting market-thumping growth. Kroger's latest 6% quarterly sales gain not only set its best performance of the year, but also extended the streak of positive comps to 45 consecutive quarters.

Costco's sales are improving at an even faster rate: 8% last quarter. The warehouse giant also signaled increased confidence in its business by issuing a special dividend to shareholders last month.

Investors have responded to this good news by sending both stocks to fresh all-time highs.

COST Chart

COST data by YCharts

But which retailer would be the better stock purchase right now? To answer that question, let's set the stage with a few key statistics:

Metric Costco Kroger
Market cap $66 billion $37 billion
Annual sales $110 billion $108 billion
Comps growth 6% 5%
Profit margin 13% 21%
Price/earnings 29 22
Price/sales 0.57 0.35

Comps are for the 2014 fiscal year and exclude gasoline sales. Profit margin is for the 2014 fiscal year. Source: Finviz.com and company financial filings.

Considering they pulled in almost exactly the same annual revenue, Costco and Kroger have very different valuations. Kroger can be purchased at a significant discount to Costco whether you're looking at earnings or sales multiples. And that's despite the grocery chain's higher gross profit margin.

Costco's profit consistency
However, one good reason to prefer Costco to its grocery-store rival is its more consistent profit growth. The warehouser gets a huge chunk of its income through membership fees, and that means shareholders can count on a steadier stream of earnings through the economy's inevitable stops and starts. The Great Recession illustrated that protection at work: Costco's net income hardly fell at all between the 2008 and 2009 fiscal years, and went right back to setting new highs directly afterward. Meanwhile, Kroger's profits are more prone to rising and falling along with consumer sentiment.

Source: Financial filings.

Costco should keep posting steady gains as long as customers remain happy with their memberships. That appears likely, as its renewal rate ticked higher to a stellar 90% last year. Costco also led all retailers in a recent survey of customer satisfaction, which suggests subscribers are getting plenty of value from their club membership. 

Kroger's market share opportunity
The bullish story for Kroger centers on its opportunity for additional market share gains. The company just completed its 10th consecutive year of grabbing share from competitors. Recently, that has meant a headache for Wal-Mart, which lost ground to Kroger in every major market last year. 

The grocer is also mounting a fresh challenge to Whole Foods by plowing into the organic and natural foods business. Its in-store organic brand, Simple Truth, hit $1.2 billion in annual sales in 2014 after launching just two years ago. 

The healthy eating segment is a big opportunity for Kroger, considering that it's growing sales by double-digits while the broader grocery industry ticks higher by just 3%. Kroger also has a few key advantages in the fight for this premium market. For one, it controls its own manufacturing facilities and so can lower costs. More importantly, Kroger operates at a lower profit margin than does Whole Foods, which allows it to compete very effectively on prices for these in-demand products.

Foolish wrap-up
Speaking of prices, you can buy Kroger's $110 billion revenue stream for $37 billion, or 0.35 times sales. You'd have to pay 60% more to own Costco's identically sized sales stream. I'd say some of the premium is well deserved. But, for my money, Kroger's cheaper valuation and hefty market growth opportunities make it the better long-term investment opportunity right now.