Analysts in a Reuters poll had predicted a 0.1 percent decline from June. Overall, 13 of the index's 21 major components were higher, while five dropped and three were unchanged.

Prices for primary non-ferrous metal products rose by 5.3 percent, the largest month-on-month gain in almost four years, on higher demand for both unwrought precious metals and precious metal alloys.

"Given the financial market volatility following Britain's decision to leave the European Union, prices for precious metals increased as investors pursued safe-haven assets such as gold and silver," Statscan said in its daily commentary.

Energy and petroleum products moderated the overall increase in producer prices, falling by 3.5 percent.

Raw material prices fell by 2.7 percent from June - much greater than the 1.2 percent decline forecast by analysts - on lower prices for crude energy products.

(Reporting by David Ljunggren; Editing by Bernadette Baum)