Spain's Economy Ministry released its trade data on Monday. The trade deficit narrowed to €1.4 billion in July from €1.83 billion in July a year ago.
Exports rose at an annual rate of 8.9% in July, while imports jumped 6.4%.
In the January to July period, the trade deficit totalled €12.9 billion, down 6.1% from the same period of 2014.
Exports increased 5.5% in the January to July period, while imports gained 4.5%.