Beauty products specialist Ulta Beauty (NASDAQ:ULTA) just closed the type of fiscal year that most retailers would kill for. Revenue shot up by 11% at existing locations thanks to a mix of impressive customer traffic growth and booming demand in its digital sales channel.

Yet the stock has dramatically underperformed the market over the past year as Wall Street worries about a slowdown in Ulta's core makeup segment that's contributing to falling profit margins. Still, with earnings set to jump 20% in 2018, this stock is attractively priced for a business with such positive long-term growth potential.

A woman buys hair products at a beauty retailer.

Image source: Getty Images.

2017 was a good year

By most measures, Ulta had an excellent 2017. Sure, sales growth decelerated in the last three quarters of the year. However, its 11% full-year comps gain surpassed management's original target despite a surprise slump in the makeup category. The retailer logged a 7% traffic increase for the year while gross profit margin held steady at 36% of sales.

E-commerce provided a nice lift to the business over the past 12 months. Sales in that channel shot up by 65% to trounce management's 40% forecast. As a result, the digital segment jumped past 10% of the broader business to pass executives' goal a full two years ahead of schedule.

Yet there's a downside to that quick shift toward e-commerce. Since these sales aren't as profitable as in-person shopping, Ulta's broader margins are taking a hit. Rather than rising slightly as management had expected, operating income slipped to 13.3% of sales last year from 13.5% in 2016.

Meanwhile, Ulta, like all its peers, is dealing with a growth slowdown in makeup that's forcing price cuts as rivals battle for market share. That tough selling environment, plus increased labor costs and the added expenses required to support a growing digital sales channel, have hurt Ulta's profit outlook. CEO Mary Dillion and her team stepped back from their goal of steadily pushing operating margin toward 15% of sales for the time being, and instead forecast a second straight year of minor declines.

Outlook and valuation

Ulta should still have no problem expanding earnings by at least 20% this year thanks to a big assist from the recent tax law changes. Its operating outlook is bright, too. Comps are projected to rise by between 6% and 8%, including a 40% surge in e-commerce sales.

Those attractive figures support management's long-term goal of increasing the store footprint to as many as 1,700 locations over time. And in 2018, an additional 100 salon shops should push that total up to about 1,200, leaving plenty of room for more gains in the years ahead.

ULTA PE Ratio (TTM) Chart

ULTA PE Ratio (TTM) data by YCharts.

Yes, Ulta's future doesn't look quite as bright as it did in early 2017, when a quickly expanding industry was powering double-digit customer traffic gains and rising profit margins. But the business is still putting up healthy results on both the top and bottom lines. It is grabbing market share at the same time, even though the makeup market isn't expanding quickly right now.

Investors are being offered a tempting discount that reflects those weaker trends. In fact, the stock is valued at about 23 times trailing earnings today compared to over 40 times a year ago.

It's hard to see that price as anything but a good deal considering Ulta's long-term opportunity hasn't changed. Sure, the industry is weakening. But Ulta is putting up industry-leading growth results both in stores and online.

Further steps toward its full market potential should keep sales growing at around 15% a year while earnings expand at closer to 20% annually. Those metrics should help deliver healthy returns to patient investors.

Demitrios Kalogeropoulos has no position in any of the stocks mentioned. The Motley Fool recommends Ulta Beauty. The Motley Fool has a disclosure policy.