China's exports for the month of March came in much higher than expected, while its imports came in much lower than expected, according to customs data released on Friday.

Dollar-denominated exports rose 14.2 percent for March from a year ago, topping expectations of a 7.3 percent rise from a year ago, according to a Reuters poll.

But dollar-denominated imports were down 7.6 percent in March from a year ago, falling short of expectations of a 1.3 percent decline from a year ago — suggesting domestic demand remained weak.

All told, that gave China a March trade surplus of $32.64 billion, according to Reuters and Dow Jones calculations. Dow Jones said the surplus was only expected to have come in at $6 billion and Reuters had expectations at $7.05 billion.

However, analysts had said the gains might be due more to seasonal factors rather than a turnaround in lackluster global demand, with shipments jumping after the long Lunar New Year holidays dampened business activity in February.

China's March trade surplus with the U.S. — a politically sensitive measure given the ongoing trade war between Washington and Beijing -- came in at $20.5 billion. That represented a wider margin than the $14.72 billion in February.

For the first quarter in total, China notched a $62.66 billion surplus with the United States, according to the data.

Following the release of the data, the offshore Chinese yuan strengthened to 6.7225 against the dollar from 6.7303, according to Reuters.

In a note following the release of the data, Julian Evans-Pritchard, senior China economist at Capital Economics, said that import volumes are "likely to remain subdued."

But, he said: "They will probably recover somewhat in the near-term as policy stimulus helps to shore up demand and temporary drags from the electronics sector's inventory cycle start to fade."

Looking ahead, while import volumes are likely to remain subdued, they will probably recover somewhat in the near-term as policy stimulus helps to shore up demand and temporary drags from the electronics sector's inventory cycle start to fade.

Global growth concerns persist, with the International Monetary Fund this week cutting its forecast for global economic growth for 2019 to 3.3 percent, from 3.5 percent. However, it upgraded its 2019 growth forecast for China in a Tuesday report, citing Beijing's efforts to support the economy and an improved outlook for the Asian giant's tariff fight with the U.S.

The IMF said in its latest World Economic Outlook report that China is projected to grow by 6.3 percent this year, higher than the fund's previous forecast of 6.2 percent.

Meanwhile, hopes are high that the U.S. and China could be close to a trade deal, with Treasury Secretary Steven Mnuchin telling CNBC that Washington and Beijing have "pretty much agreed on an enforcement mechanism" for when a deal is struck.

— Reuters and CNBC's Yen Nee Lee and Eustance Huang contributed to this report.