The surplus climbed 4 percent to $25.3 billion from a year earlier, the first gain in four months, customs bureau figures showed. Factory-gate prices increased 10 percent, the statistics bureau said earlier today.
The benchmark stock index slumped the most in six weeks on concern higher raw-material and energy costs will erode earnings. China halted the yuan's gains and eased lending curbs last month, putting a bigger emphasis on economic growth than fighting inflation as export demand cooled.
The yuan rose 0.02 percent to close at 6.8577 at 5:30 p.m. in Shanghai after the trade numbers were released, reversing an earlier decline. The currency has fallen 0.1 percent against the dollar this quarter after gaining 4.2 percent in the first quarter and 2.3 percent in the second.
The CSI 300 Index fell 5.2 percent to an 18-month low. The gauge has tumbled 54 percent this year after more than doubling in 2007.
The trade surplus and the 26.9 percent increase in exports to $136.7 billion topped the estimates of all 16 economists in a Bloomberg News survey. Overseas shipments grew a revised 17.2 percent in June. Imports increased 33.7 percent in July to $111.4 billion, up from 31 percent.
Exports to the U.S. rose 9.9 percent in the first seven months of 2008 from a year earlier after gaining 8.9 percent in the first half. Those to the European Union increased 27.1 percent after climbing 27 percent. Shipments to Japan rose 15.9 percent after increasing 15.1 percent.
The yuan has gained 18 percent against the dollar in the past three years. It's likely to strengthen 3.6 percent to 6.63 against the dollar in the second half of the year, according to the median estimate of 25 analysts surveyed by Bloomberg.
Officials and manufacturers in the U.S. and Europe say the currency is kept artificially weak to help exporters.
Weaker gains help exporters by keeping their products cheaper in overseas markets, while stronger appreciation counters inflation by lowering import costs.
The government has raised export tax rebates for garments and textiles to protect jobs after economic growth slowed for a fourth quarter to 10.1 percent in the three months through June. China is still the fastest-growing of the world's 20 biggest economies.