Strong GDP a head fake, buy this on the coming slowdown

The third quarter was great, but growth during that period likely won't be matched in 2015, posing a challenge for investors looking to play economic cycles.

A revision for third-quarter real gross domestic product on Tuesday came in at 3.9 percent, higher than the 3.5 percent economists expected.

Nice data point, but that puts year-to-date GDP growth at just above 2 percent, according to research firm The Lindsey Group.

And everyone from Goldman Sachs to T. Rowe Price believe a mild annual rate of about 3 percent will be the norm for the next five quarters.

So if that's as good as it gets, what should your portfolio look like? ran the numbers and found that stocks whose revenues are not dependent on the economic cycle such as Boeing and Lockheed Martin, do best during times of tepid economic growth. Shares of companies that pay healthy dividends like utilities, also do well.

There have been 30 quarters since 1980 when GDP growth was middling along at a rate between 2.5 percent and 3.5 percent, according to the analysis. The last such extended stretch was in 2010 when the economy struggled to make the transition from recession to recovery.

Major defense stocks had positive returns more than two-thirds of the time during these periods and, on average, more than doubled the S&P 500's return, according to Kensho, an analytics tool used by hedge funds.

Weapons producer Raytheon traded positively more than 90 percent of the time during these slow growth stretches, with a median equity return of 15 percent. Lockheed Martin, a manufacturer of fighter jets and other major apparatus for defense, traded in the green on nearly 90 percent of the occasions with an 18 percent median return. Boeing and General Dynamics traded positively on more than 70 percent of these occasions,with median returns of 19 percent and 17 percent respectively.

What's more, the third-quarter GDP report showed defense spending rose at its fastest pace since the second quarter of 2009.

"This is the first quarter we've seen some expansion in the military," said Jack Ablin, chief investment officer at BMO Private Bank, who is targeting GDP growth around 2.5 percent for 2015. "I think that's going to continue."

Read MoreAmerica is losing the global start-up race

As for public utilities, some of these stocks had impeccable track records during periods of sluggish growth as some investors sought the industry's high dividends as an antidote to the low interest rates that often accompany economic cycles such as these.

Centerpoint Energy traded positively more than 90 percent of the time during the 11 quarters it's been a public company and economic growth was between 2.5 and 3.5 percent. The Houston electricity distributor sports a dividend of 2.9 percent, greater than the 2 percent average for all of the S&P 500.

CMS Energy, whose primary subsidiary Consumers Energy is Michigan's largest electric and natural gas utility, also traded positively more than 90 percent of the time. Its dividend yield is 3.3 percent.

Some of this slow-growth bid may already be in the utility stocks as the S&P Utilities SPDR is up 19 percent this year, better than the 12 percent gain for the S&P 500 Index.

However, defense stocks have underperformed the market this year with the S&P Aerospace and Defense sector index up just 8 percent in 2014.

To be sure, keep an eye on the new Congress if you load up on defense stocks. Budget cuts which may arise out of any bipartisan deal could dent the upward trend for defense spending. And the Monday resignation of U.S. Defense Secretary Chuck Hagel is all the more reason to keep a close eye on any dovish developments out of Washington.

Read MoreUS can't dodge global slowdown forever

Disclosure: CNBC's parent, NBCUniversal, is a minority investor in Kensho.