OTTAWA - Canadian new home prices rose in July as Vancouver saw strong demand from buyers, while prices in Toronto were unchanged for a second month in a row following provincial measures to rein in the market, data from Statistics Canada showed on Thursday.

Nationally, prices were up 0.4 per cent from June, slightly exceeding economists' forecasts for a gain of 0.3 per cent. Compared to a year ago, prices were up 3.8 per cent.

The new housing price index excludes apartments and condominiums, which have seen strong demand in Vancouver and Toronto recently as potential buyers have been priced out of more expensive single-family homes.

Vancouver led the price growth in July with a 2 per cent monthly increase. A tax on foreign buyers implemented by the provincial government in August 2016 initially cooled the market but prices and sales have been heading back up recently.

Prices in the west coast city have climbed 7.7 per cent since the start of 2017 when a loan program for first-time buyers was introduced by the British Columbia government, the statistics agency said.

In Toronto, Canada's largest city, prices were unchanged on the month, though they were still up 7.4 per cent from a year ago.

Toronto home sales have dropped in the wake of a number of measures taken by the Ontario government in April to cool the market, including a foreign buyers tax.