Barrick Gold, Newmont Mining, Kinross Gold all gained about 4%.
In economic news, the National Association of Realtors said new home sales fell 1.2% in June. The group blamed higher mortgage rates in certain high-end markets.
Shares of homebuilders were under pressure. Hovnanian, D.R. Horton and Lennar all fell about 2%.
World markets: In Europe, the major indexes ended narrowly mixed.
Asian markets also closed out the day in mixed territory. Japan's Nikkei advanced by 0.5% after voters rewarded the architects of Abenomics with a sweeping electoral victory.