Japan’s exports grew for a seventh consecutive month in June, supporting the view that in the second quarter the economy will recover from the preceding three months’ contraction.

Exports gained 5.4% from a year ago, led by chip-making gear and nonferrous metals, the Finance Ministry reported Thursday. The result missed economists’ consensus estimate of a 7.2% increase.

Imports rose 3.2%, compared with a 9.6% gain estimated by analysts. With a smaller than expected rise in imports, the trade balance turned to a surplus of ¥224 billion from a deficit of ¥1.22 trillion in May.

The value of the shipments was boosted by a weak yen, which the finance ministry said traded at an average of ¥156.64 against the dollar in June, 12.5% weaker than a year ago.

By region, Japan’s shipments to the U.S. gained 11%, while those to China rose 7.2% and exports to the European Union dropped 13.4%. There are some clouds in the outlook as China’s growth unexpectedly slowed to the worst pace in five quarters in the three months ended June, putting pressure on policymakers to step up support.

The weak yen helps boost Japanese exporters’ overseas earnings, but its effects on the overall economy is a mixed bag. The softer currency simultaneously fuels concerns over inflation in energy, food and materials for the resource-scant nation.

The Japanese economy needs strong exports to stage a rebound in the quarter through June, especially as consumer spending remains fragile with persistent inflation weighing on households. The economy shrank in the first quarter with both consumers and companies cutting back on spending.