The stock market did well in 2017, with broad market averages scoring gains of 20% or more. Yet the gains in the market weren't spread evenly across all types of stocks. Some sectors of the market struggled just to break even, while others posted decent gains but still lagged the major market benchmarks.

The Sector SPDR ETF family looks at 10 different sectors of the market, tracking in line with primary industry classifications that each company has. Among those 10, three of the Sector SPDRs significantly underperformed the market. Below, we'll look at why Energy Select Sector SPDR (XLE 0.07%), Real Estate Select Sector SPDR (XLRE 0.38%), and Utilities Select Sector SPDR (XLU 0.60%) lagged behind the broader S&P 500.

XLE Total Return Price Chart

XLE total return price data by YCharts.

Feeling less than energetic

The energy SPDR was by far the worst performer in 2017, being the only one to lose money during the year. The downward move among energy stocks was surprising to some, given that crude oil prices actually started to move higher over the course of the year, pushing above the $60-per-barrel mark by the end of the period. But within the industry, natural gas prices had weaker performance than crude oil, and services companies that assist with drilling and production operations suffered from a general lack of demand. Among larger players, concerns about the ability to replace production with new reserves also weighed on share prices.

Nevertheless, many investors are more optimistic about 2018's prospects. Strength in areas like refining helped offset some losses elsewhere in the industry, and rising potential growth for midstream pipeline, storage, and transportation companies also bode well for the coming year. As energy continues to adapt to current prices, value investors see the sector as a place where solid returns might emerge for 2018 and beyond.

Four oil pumps next to each other on a hazy day near sunset.

Image source: Getty Images.

Real estate holds its own

It's hard to fault the real estate SPDR too much, given that it managed to post a double-digit percentage total return for the year. Lagging the broader market by half, though, is still a defeat in many investors' eyes. Real estate investment trusts weren't able to match the market's performance in 2017, largely because fears about interest rate increases weighed on the sector after a long run of strength in both commercial and residential property.

One thing to remember about the SPDR, however, is that it owns REITs that focus on a wide variety of different types of real estate. You'll find mall operators, storage facilities, and multifamily residential REITs among its holdings, but the SPDR also owns more specialized companies like cellular tower operators, lumber producers, and data center owners. The income-based nature of real estate sometimes dampens capital appreciation during times of strength for the broader market, but it can also avoid downside volatility in some cases as well.

Utilities deal with debt

Finally, the utility SPDR produced returns of about 12%. Outsized returns aren't very common for utility stocks, especially those whose operations are heavily regulated. For these utilities, profits tend to be predictable, but the downside of that feature is that utility stocks don't see big positive surprises that drive top returns in most years. Moreover, some of the events that drove other sectors higher didn't show up in utility stock returns, such as the tax reform bill's anticipated reduction in tax liability.

The bigger issue for utilities in the long run is how higher interest rates could affect their capacity to maintain debt successfully. Utilities tend to have extensive debt on their balance sheets in order to finance expensive and capital-intensive transmission and distribution networks. Fortunately, most regulated utilities can pass on those costs to customers. Yet the share prices of stocks in the sector tend to be vulnerable to rising rates as well, because other income-focused alternatives become more attractive when rates go up. A lot will depend on whether anticipated short-term rate increases translate to higher financing costs on the long end of the yield curve as well.

Will these sectors bounce back in 2018?

These sectors did the worst in 2017, but often what does badly one year will rebound the next. There's no guarantee that an out-of-favor group of stocks will become market favorites immediately, but using sector ETFs like these SPDRs will let you invest in a way that's consistent with your view on what's ahead for these and other industries in the economy.