Shares of Costco (Nasdaq: COST) hit a 52-week high yesterday. Let's take a look at how it got here to find out whether there are still clear skies ahead.

How it got here
Costco isn't the only big-box retailer to explore new highs lately. Over the past year it's kept pace with Target (NYSE: TGT) and has been left behind by Wal-Mart's (NYSE: WMT) summertime surge:

COST Total Return Price Chart

COST Total Return Price data by YCharts.

There's been a bit of divergence lately in brick-and-mortar retail, and Costco and its peers have cashed in. Office supply and electronics big-box stores have wilted under sustained assault from diverse retail options from the "Big Three" (that's Costco, Wal-Mart, and Target to you), and Amazon.com's (Nasdaq: AMZN) willingness to endure razor-thin margins in order to build market share has also contributed to the shift.

Wal-Mart may have bested Costco in stock-price growth, but much of that recent rise has been pure multiple expansion, as Foolish contributor Jeremy Bowman points out. Does that mean Costco's a better value today? Perhaps not. Over the past five years, Costco's P/E ratio has grown more than Wal-Mart's, and Target's has actually dropped over time:

COST P/E Ratio Chart

COST P/E Ratio data by YCharts.

Amazon's in a class by itself when it comes to P/E, but the three superstores can be readily compared to each other. Let's do that -- and we'll look at PriceSmart (Nasdaq: PSMT), the "Costco of Latin America," as well, to see what Costco's potential for growth might be in emerging markets. Costco itself has 32 locations in Mexico, but has much greater international potential than it is currently realizing.

What you need to know
Costco is only cheap when compared to Amazon, but its price-to-free-cash-flow ratio is slightly more reasonable. However, considering that its growth rate is very close to Target's, Costco's ratios seem to have acquired premium status:

Company

P/E Ratio

P/FCF

Net Margin (TTM)

Projected Growth Rate (2013)

Costco 27.5 25.5 1.7% 14.5%
Wal-Mart 15.2 19.1 3.5% 8.9%
Target 14.7 12.1 4.1% 12.1%
Amazon 299.9 55.9 0.7% 110.1%
PriceSmart 35.2 109.0 3.2% 19.5%

Sources: Yahoo! Finance and Wolfram Alpha. TTM = trailing 12 months.

It doesn't help Costco's case to have underperformed its summer same-store sales projections. Confusing -- but mostly underwhelming -- consumer numbers don't bode well for Costco or its peers, but much will depend on the economy's trajectory. Discount retailers are better positioned than premium stores in a downturn, but Costco straddles the discount line somewhat with its annual memberships and diverse offerings, which include fuel, electronics, and the occasional grand piano in addition to supersized grocery fare.

What's next?
Where does Costco go from here? Over the long run, I wouldn't bet against it. Costco deftly avoids the negative press that occasionally follows Wal-Mart and has a level of consumer loyalty surpassing most grocers. That will keep its stores stuffed with shoppers. In the short run, consumer weakness may dent Costco for a quarter or two -- but that should be more of a buying opportunity than a reason to flee. I'd keep my eye on those valuation ratios, as Costco's current P/E is nearly 20% higher than its five-year average.

The Motley Fool's CAPS community has given Costco a perfect five-star rating, with 97% of our CAPS players expecting the company to beat the indexes over the long run.

Interested in tracking this stock as it continues on its path? Add Costco to your Watchlist now, and get all the news we Fools can find, delivered to your inbox as it happens. PriceSmart's status as the "Costco of Latin America" led the Fool to name it our Top Stock for 2012. You can learn everything you need to know about this high-flying wholesaler in our exclusive free report. Click here for access while it's available.