This is the best way to play gold's massive rally

Johnny Greig | Getty Images

Instead of investing in gold amid the recent market volatility, HSBC told clients to hide out in a select group of stocks.

"Gold stocks are the natural winners of political and economic uncertainty after the U.K.'s EU referendum," HSBC analyst Volker Borghoff wrote in a research note Wednesday, in response to the sharp price movements caused by the Brexit vote.

Stocks that exhibit a high sensitivity to the gold price provide a hedge under such an environment, he added.

The precious metal, which usually thrives during market uncertainty, hit a two-year high this week and is up about 25 percent in 2016.