The market closed higher despite slipping in afternoon trade due to concerns about an economic slowdown in China.
The benchmark S&P/ASX 200 Index added 19.7 points, or 0.4 per cent, to 4901.4. The broader All Ordinaries Index gained 18.9 points, or 0.39 per cent, to 4885.4.
Data from the world's second-largest economy showed exports unexpectedly fell 3.1 per cent in June, and imports fell 0.7 per cent.
IG market analyst Chris Weston said the market shed most of the gains it had posted in morning trade after the release of weaker than expected Chinese figures.
"The Chinese data has been a slap back to reality," he said. "Chinese growth is firmly in question and that's going to have massive ramifications for the Australian economy."
The resource sector, heavily dependent on Chinese growth, was hit the hardest in afternoon trade.
BHP Billiton closed 22¢ higher at $31.83 after rising by as much as 86¢ earlier. Rio Tinto gained 35¢ to $52.39, well below its earlier gains of up to $1.36. Newcrest was back in positive territory after several days of heavy selling, in line with the falling gold price. Its shares gained 21¢ to $9.95.
The big four banks were mixed, with ANZ losing 2¢ to $28.64. National Australia Bank edged 3¢ higher to $29.45, Westpac added 9¢ to $29.04 and Commonwealth gained 21¢ to $70.35. Macquarie Group rose $1.38, or 3.2 per cent, to $44.89 after positive broker reports on Tuesday. National turnover was 1.6 billion securities worth $4.5 billion.
Meanwhile, the dollar was higher after bouncing back from losses caused by the Chinese trade figures. At 5pm on Wednesday, it was trading at US91.96¢, up from US91.83¢ on Tuesday.
LTG Goldrock director Andrew Barnett said the dollar dipped after official data from China showed the country's monthly trade surplus fell by 14 per cent in June, as imports and exports both unexpectedly declined.
But the market was now awaiting Australian June labour force figures and the US Federal Open Market Committee minutes, both to be released on Thursday morning, Australian time, he said.
"What the Aussie is going to really react to are the FOMC minutes and any comments that US Federal Reserve chairman Ben Bernanke makes on Thursday," Mr Barnett said.