The stock market has dramatically outperformed gold as an investment over the long run. However, when investors get worried about the prospects for stocks, they often turn to gold for its reputation as a safe-haven investment. Despite a strong performance for stocks so far in 2019, gold has recently seen its price rise substantially, and some of the precious metal's best days come when investors seem worried about whether the 10-year-old bull market in stocks can continue.

If you want to add gold to your investment portfolio, however, there are multiple ways to do it. Investing in gold coins and bullion ensures that you'll get direct exposure to the ups and downs in the gold market, but doing so involves going to specialized dealers and coming up with ways to store the yellow metal safely. Some exchange-traded funds, such as the SPDR Gold Trust (GLD 0.12%), allow indirect ownership of gold bullion, collecting fees to store and manage the precious metal. Other ETFs, including the VanEck Vectors Gold Miners (GDX -1.27%) and the VanEck Vectors Junior Gold Miners (GDXJ -1.54%), invest in companies that mine gold and other precious metals, and these companies tend to do better when gold prices are strong.

As you can see below, the performance so far in 2019 dramatically favors gold mining company stocks over gold bullion itself.

Graph showing year-to-date return on various gold investments.

Data source: Ycharts. Chart by author.

It might seem odd that large-cap gold miners have done better than their small-cap counterparts. In many industries, smaller companies are nimbler and better able to respond to changing conditions. Yet even when bullion prices cooperate, small mining companies often have operational challenges that can jeopardize their long-term financial viability. Even over longer periods of time, the industry's giants have tended to see their stocks have stronger returns than small companies in the mining industry.

Many financial experts don't like physical gold as an investment, including most notably legendary investor Warren Buffett. But mining companies are businesses first and gold plays second, and well-run miners can produce profits that can in turn lead to solid investment performance.