Garbage stocks may be the key to success in a sluggish economy, and Waste Management "should be a core holding in every portfolio," according to Goldman Sachs.

The firm on Monday raised its rating on the trash giant two notches to outperform from underperform, a rare "double upgrade."

"Given the age of the current business cycle and expectations for slowing economic growth, we believe now is the right time to own waste stocks," analyst Brian Maguire wrote to clients. "The waste sector not only compounds earnings growth at a higher rate than the overall market, but it does so with much less volatility and draw-downs in its earnings."

The $40 billion garbage and recycling company's stock has outperformed the broader market this year and proved to be a reliable bet amid growing volatility. Shares are up 7.8 percent since January and have remained above their 200-day moving average — often considered a barometer of whether securities are in a healthy long-term trend — for the vast majority of the year.

The VanEck Vectors Environmental Services ETF, an exchange-traded fund that tracks an index of companies that benefit from increased demand for waste management, is up 7.4 percent this year and more than 8.1 percent in the last 12 months. Maguire raised his 12-month price target to $107 from $84, implying 14.9 percent upside over the next year.

Shares rallied 1.8 percent Tuesday morning following the Goldman note.