Are you feeling whipsawed by current market volatility? Recently on the Motley Fool's Industry Focus podcast, Fool.com analyst Vincent Shen and I discussed the Consumer Staples Select Sector ETF (NYSEMKT:XLP) as a defensive idea for those seeking a calming influence on their investment portfolios.

While the exchange-traded fund trails the S&P 500 index year to date (it's lost 1 percentage point versus the index's 4.63% gain), over the last six months, the XLP ETF has handily outpaced the larger index. It appears that a deteriorating market has reminded investors of the value of stable, consumer-staples stocks:

XLP Chart

XLP data by YCharts.

Major fund holdings like Procter & Gamble, Coca-Cola, and Costco are prized in times of uncertainty for their predictable earnings and ample cash flows, not to mention their nerve-calming, if rather phlegmatic stock price movement. You can learn more about the XLP ETF in detail in our podcast discussion.

If you're attracted to the relative safety of the consumer sector and are willing to take a moderate amount of additional risk, consider also buying the Consumer Discretionary Select Sector ETF (NYSEMKT:XLY), a sister fund to XLP. As its name suggests, the XLY ETF is based on the consumer discretionary sector of the S&P 500, just as XLP is based on the consumer staples sector.

Over the last six months, the XLY ETF has tracked closer to the broader market. Roughly in line the S&P 500 Index, it's down just under 3% during the period. However, on a year-to-date comparison, XLY has handily exceeded the S&P and the staples ETF:

XLP Chart

XLP data by YCharts.

Armchair investment detectives: Can you guess why this fund, which holds stocks that benefit from consumers' noncore (i.e. discretionary) spending, would trail both the staples-focused XLP ETF and S&P 500 over the last six months while outgunning them when we look to the longer year-to-date period?

The answer lies in Amazon.com, which is by far the fund's largest position at 22% of total holdings. While still up nearly 52% year to date, Amazon has retraced some ground in the second half of 2018, and this has consequently impacted XLY's performance. Amazon's influence is counterbalanced by the fund's next three largest holdings: Home Depot (10% of total holdings), McDonald's (6.9%), and Nike (4.8%). Adding in Booking Holdings (4.4%) and Starbucks (4%), we see that just six high-quality stocks account for 52% of XLY's investments. The remaining 48% of the fund is divided among 59 additional positions.

The XLY ETF is one of the largest and most liquid vehicles for broad exposure to consumer discretionary stocks, sporting a total net asset value of $13.6 billion. Its expense ratio is a modest $0.13, and the fund's dividend currently yields 1.33%. Since the fund's holdings are all S&P 500 constituents, the mean market cap of the fund is $39.9 billion. XLY has averaged a 9% annual return since its inception in December 1998.   

Businessman's hand stops a row of dominoes from falling, connoting a successful defensive strategy.

Image source: Getty Images.

A few things to consider before buying

While XLP may provide relative outperformance versus highly concentrated tech, healthcare, or industrial ETFs if the market continues to deteriorate, bear in mind that discretionary stocks tend to be cyclical. When the economy falters, discretionary stocks fall from favor, as in theory consumers have less income at their disposal, and focus their purchases on essentials (i.e. staples). However, over a long-term holding period, such cyclical fluctuations get ironed out, as the fund's long-term annual average return of 9% demonstrates.

Additionally, the XLY ETF may prosper when the market is in defensive mode, but as an investment instrument, it tends to exhibit higher volatility than the broader market most of the time -- its current beta sits at 1.36. If the XLY is roughly one-third more volatile than the market, its sister XLP ETF, exhibiting a beta of 0.34, is approximately one-third as volatile as the overall market.

I think it's a sound idea to hold both in your portfolio. By purchasing XLY and XLP, an investor can enjoy exposure to the thematically important (i.e. defensive) consumer sector, with safety in staples should the market deteriorate quickly, and both safety and higher potential in discretionary stocks. So try pairing these two and weighting them according to your risk appetite.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Asit Sharma has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Amazon, Booking Holdings, and Starbucks. The Motley Fool has the following options: short February 2019 $185 calls on Home Depot and long January 2020 $110 calls on Home Depot. The Motley Fool recommends Costco Wholesale, Home Depot, and Nike. The Motley Fool has a disclosure policy.