Shares of industrial and transportation companies rose as traders bet the U.S. and Iran would avert a return to full-blown war.

One strategist said recent weakness in defense contractors is an indication of market expectations for a lull in U.S. military spending. "The market appears to be pricing in a 'peak defense' narrative, with concerns that defense spending growth could slow after the Iran conflict and that a potentially divided government following the midterm elections could make future budget increases more difficult," said Tony Bancroft, portfolio manager at Gabelli Funds, in a note to clients.

WD-40 shares rose after the maker of lubricating oil posted fiscal third-quarter earnings and revenue ahead of Wall Street targets.

German auto maker Volkswagen plans to cut its car lineup by up to half and reduce production capacity in its second major overhaul in under two years. Rival BMW said a sharp drop in sales in China dragged down its overall performance in the first half of the year.

Write to Rob Curran at rob.curran@dowjones.com