Factory output in Japan unexpectedly rose in June as manufacturers showed resilience even as U.S. tariffs weigh on the nation’s exports.

Industrial production gained 1.7% from the previous month, the industry ministry reported Thursday. Output of transport equipment excluding cars, up 14.8%, and electronic parts and devices drove the gains. Economists had expected a 0.8% loss. Output increased 4% from a year earlier, topping expectations of a 1.3% gain.

The output of autos, which faced tariffs totaling 27.5% on shipments to the U.S. during the period, nudged 0.1% higher from the prior month. Output for steel and non-ferrous metals declined by 0.5% after U.S. President Donald Trump doubled the duty on U.S. imports of steel and aluminum to 50% in early June.