Department store stocks have plunged this year, as investors have started to fear that mall-based retailers will be unable to stabilize their sales.

Yet while Nordstrom (JWN 0.48%) isn't completely insulated from the impact of falling mall traffic, growth in its e-commerce and off-price businesses has more than offset the sales declines in its full-line stores. This trend continued in the second quarter.

Sales growth continues -- despite ongoing off-price challenges

In the second quarter, Nordstrom's revenue reached $3.79 billion -- about 1% ahead of the average analyst estimate and up 3.9% year over year. Comparable-store sales increased 1.7%, driven by 20%-plus growth in its e-commerce revenue.

The exterior of a Nordstrom Rack store, with a full-line Nordstrom in the background

Nordstrom posted solid comp sales growth last quarter. Image source: Nordstrom.

Management did acknowledge that the company missed its sales plan for the Nordstrom Rack off-price chain. Comp sales declined 1% year over year in Nordstrom Rack stores, in line with recent trends. That said, comp sales rose 3.1% for the off-price business as a whole, as the Nordstromrack.com website continues to gain popularity.

Nordstrom experienced some margin pressure during the quarter, due to technology investments, rising supply-chain costs, and increased occupancy expense related to new stores. Even so, earnings per share (EPS) were roughly stable on a year-over-year basis, declining to $0.65 from $0.67 a year earlier.

For comparison, Macy's (M -2.78%) reported a steeper 5.4% sales decline, with comp sales down 2.5% year over year. This highlights how Nordstrom is much less exposed to the negative mall traffic trends that are hurting other department store companies.

The Anniversary Sale is still a big winner

Nordstrom's annual Anniversary Sale began near the end of the quarter and provided a big sales lift for the second consecutive year. This is a unique shopping event. Typically, department stores put items on sale when they have sat on the shelves too long. They then mark items down further to clear out merchandise at the end of the season.

A rendering of a Nordstrom store

Nordstrom's Anniversary Sale was a big success this year. Image source: Nordstrom.

By contrast, for the Anniversary Sale, Nordstrom marks down new fall-season merchandise. At the end of the sale, prices go back up. The discounts are particularly notable because Nordstrom sells a lot more merchandise at full price than most of its rivals.

Nordstrom generated positive comparable-store sales in its full-line business during this year's sale. That was a solid improvement relative to the first quarter and the bulk of the second quarter. Clearly, consumers will still go to the mall if there's a good enough reason to do so.

On the flip side, sales trends in Nordstrom's full-line stores remained fairly weak aside from the Anniversary Sale. As a result, Nordstrom executives acknowledged that the recent uptick in full-line sales trends probably won't continue through the end of the year.

Don't fear the earnings declines

At Macy's, adjusted operating income fell by 25% last quarter, excluding the impact of asset sale gains. The company is facing pressure on both sales and gross margin, offsetting the impact of its cost-cutting efforts. In short, negative mall-traffic trends are having a significant impact on Macy's profitability.

By contrast, Nordstrom's operating income declined by just 2% in the second quarter, boosted by strong profit growth from its credit card partnership. Clearly, Nordstrom is better-positioned than Macy's for the ongoing shifts in the retail industry.

To be fair, Nordstrom expects adjusted EPS to fall this year, reaching $2.85 to $3, compared to $3.14 in fiscal 2016. However, growth investments are the main cause of this earnings pressure.

For example, Nordstrom is getting ready to open its sixth full-line store in Canada next month. It will also open the first phase of its Manhattan flagship store in early 2018, with the main store set to open in the fall of 2019. As a result, it is incurring significant pre-opening expenses this year. Meanwhile, Nordstrom's technology expense is rising.

These investments are denting Nordstrom's earnings this year, but they should pay off in the form of faster future earnings growth. (By contrast, there's no particular upside to Macy's earnings declines.) Mr. Market isn't giving Nordstrom much credit for this earnings growth potential -- which makes the stock a great bargain for long-term investors.