Japan's factories extended expansion in output to a second month in July as motor vehicle production improved, marking a positive start to the third quarter for manufacturers and broader economic activity.

Separate data showed retail sales grew for a fifth straight month in July, adding to hopes that the world's third-largest economy will benefit from resilience in spending by consumers in the current quarter.

Factory output rose a seasonally adjusted 1.0% in July from a month earlier, official data showed on Wednesday, extending the prior month's near double-digit surge.

Output was boosted by higher production of passenger cars and trucks and general-purpose machinery to come in better than a 0.5% decrease expected by economists in a Reuters poll.

Production of electronic parts and devices, however, declined a sharp 9.2% after surging 11.6% in June.

The data comes after Japan's main automaker Toyota Motor Corp said on Tuesday its global vehicle production for July had fallen 8.6% year-on-year, missing its target for the fourth straight month.

Manufacturers surveyed by the Ministry of Economy, Trade and Industry (METI) expected output to rise another 5.5% in August and 0.8% in September.

Separate data showed retail sales were stronger than expected, rising 2.4% in July from a year earlier to extend its gains to a fifth straight month.

Retail sales were helped by stronger sales of medicine and toiletries as well as general merchandise.

That compared with a median forecast for a 1.9% advance in a Reuters poll.