What happened

GPS device specialist Garmin (GRMN -1.03%) gained 23% to modestly outperform a broader stock market that rose 19% in 2017, according to data provided by S&P Global Market Intelligence.

^SPX Chart

^SPX data by YCharts.

That rally extended an impressive 2016, during which Garmin's stock soared 31%.

So what

Garmin delivered solid sales and profit results throughout the year, but its third-quarter announcement really showed off the power of its diverse product lineup. Despite weakness in its fitness and automotive categories, overall revenue rose 3% thanks to growth in its outdoor, marine, and aviation segments. Gross profit margin improved to 58% as well, as many of its new product introductions found traction in the market.

A jogger interacts with her smartwatch.

Image source: Getty Images.

Those results stand in stark contrast to Fitbit (FIT), which has a much narrower product lineup that's dependent on just a few offerings. Fitbit's revenue fell 35% over the first three quarters, and its gross margin declined to 42% of sales from 45% in the prior-year period.

Now what

Like Fitbit has, Garmin noticed more weakness in its fitness wearables division heading into the key holiday quarter. Thus, management now sees that segment shrinking by 7% for the full year. However, its other categories are expected to more than offset that decline, leading to another year of higher annual sales and profits driven by Garmin's successful diversification initiative.