Costco Wholesale (NASDAQ:COST) has been gaining momentum recently, with comparable sales accelerating after a lull in 2016. In August -- the final month of Costco's 2017 fiscal year -- the company continued its comeback, delivering another month of stellar sales growth.

The upward trajectory continues

In August, Costco's sales surged 10% year over year, driven by a 7.3% comp sales increase. Exchange rate changes and gasoline prices both contributed to Costco's sales growth last month. Holding those factors constant, Costco's adjusted comp sales increased 5.9%.

These comp sales results represent a big improvement relative to the trend prevailing in the first half of Costco's 2017 fiscal year. For the full fiscal year, Costco's adjusted comp sales rose 3.8%, including a modest 3.6% increase in the key U.S. market. (In the first half of fiscal 2017, company-wide comp sales rose just 2% year over year.)

The exterior of a Costco Wholesale warehouse

Costco posted strong sales growth across the board in August. Image source: Costco Wholesale.

Digging into the numbers

Costco saw broad strength across virtually all of its product categories last month. Televisions were the only major product line for which sales declined in August.

Additionally, Costco Wholesale produced fairly similar results in each of its major geographical regions. Adjusted comp sales increased 6.1% in the U.S., 4.3% in Canada, and 6.7% for the rest of the world. Japan, the U.K., Australia, and Mexico produced the strongest comp sales growth (in local currency).

The weaker results in Canada were driven primarily by cannibalization related to new locations that Costco has opened near existing warehouses. Management estimates that cannibalization reduced comp sales growth by 2.8 percentage points in Canada and roughly 1 percentage point on a company-wide basis during August.

Costco's e-commerce site is gaining traction

In recent months, Costco Wholesale has been reporting steady growth in customer traffic to its warehouses. This has driven the bulk of its sales gains. However, Costco's e-commerce site is also starting to take off after being somewhat neglected for many years.

During the month of August, comparable e-commerce sales rose 26% year over year. A variety of improvements are driving this growth. Most importantly, Costco has modernized the website's user experience, making it easier for customers to navigate and find what they are looking for. Faster shipping and rising consumer awareness of Costco's e-commerce site are also contributing to this acceleration in online sales growth.

Costco's growth potential is underappreciated

Costco Wholesale stock trades for about 25 times forward earnings. That represents a premium relative to the broader market, but it is quite low by Costco's standards.

COST PE Ratio (Forward) Chart

Costco Wholesale Forward P/E Ratio. Data by YCharts.

Considering its massive growth opportunities, Costco stock is well worth its premium valuation. The company routinely produces mid-single-digit comp sales growth in its mature markets of the U.S. and Canada while commanding exceptional customer loyalty. Meanwhile, it continues to find plenty of sites for new locations in these markets. During the 2017 fiscal year, Costco added 19 more warehouses in the U.S. and Canada to the 592 it already operated.

The warehouse giant has even more room to grow in other countries. Despite years of international expansion, less than 20% of its warehouses are outside the U.S. and Canada. For example, Costco is just starting to open locations in continental Europe, a wealthy, U.S.-sized market.

In its recently ended 2017 fiscal year, Costco surpassed $125 billion in sales. Even so, it's just scratching the surface of its ultimate potential. Thus, there's still plenty of upside left in Costco Wholesale stock for long-term investors.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.