China's exports and imports rose at an unexpected rate in July after declining sharply in the previous month, while the trade balance narrowed considerably more than expected in July, according to data released early on Thursday.

Data released by the Chinese government showed exports were up 5.1 percent from a year earlier and imports were up 10.9 percent. In contrast, economists had expected exports to have grown 3 percent and imports to have gone up by 2.1 percent in July.

China's trade surplus figure also sprung a surprise, contracting to $17.82 billion, sharply down from $27.1 billion in the year-ago period. Analysts had expected the country’s trade surplus to grow to $27.2 billion in July.

In June, exports had recorded a year-on-year loss of 3.1 percent -- the first decline in 18 months -- compared to expectations of a 4 percent rise. Imports were down 0.7 percent while the forecast was for them to grow by 8 percent.

China’s trade data has seen significant variations after Chinese authorities ordered a crackdown on the use of fake export-shipment documents for speculative capital gains by the country's exporters. Economists are expecting that the country’s trade data would stabilize toward the end of year.

The unexpected surge is attributed to improving demand in foreign markets including in the U.S. and euro zone countries, while rising imports could be the result of an increase in domestic demand, reflecting China’s recent efforts of guiding its economy to a domestic-consumption oriented model.