Exports leapt 7.9 percent from a year earlier to €17.88 billion ($23billion) in January while imports rose 5.7 percent to €21.38 billion, largely because of an increase in demand for energy products, the Economy Ministry said.
As a result, the trade deficit narrowed by 4.3 percent to €3.5 billion.
Spain boosted exports especially to markets outside of the European Union, the ministry said, noting that the EU-bound exports made up 63.5 percent of the total, down from 66 percent a year earlier.
Exports soared by 43.8 percent to Asia, 16.6 percent to Africa and 15.1 percent to Latin America, the government said, noting in particular a rise in exports to emerging markets such as India, up 35.4 percent, China, up 15.2 percent, and Brazil, up 28.5 percent.
In 2012, the eurozone's fourth-largest economy shrank the trade deficit by 33.6 percent as exports grew 3.8 percent and imports to the depressed domestic market fell 2.85 percent.