Australian shares erased morning losses and edged up 0.2 percent on Wednesday, after an attempt by bears to take the index below a key support level fizzled out. The S&P/ASX 200 index gained 12.72 points to 5,248.30 at the close of trade. Wednesday was the third time in the past week when bearish bets tried to push the index below 5,200. Early in the day, all banks were down, but Australia & New Zealand Bank finished up 0.6 percent and Commonwealth Bank of Australia 0.1 percent higher. National Australia Bank and Westpac Banking Corp were still down at the end. Miners extended earlier gains with Fortescue Metals Group surging 6 percent, while Rio Tinto and BHP Billiton rose around 1 percent. New Zealand's benchmark NZX 50 index added 0.4 percent or 22.77 points to close at 5,918.26. It was the ninth straight session of gains. During the day, the index touched a 2-1/2-month high. Worries about a slowdown in China, Australia's key export market, and uncertainty over the timing of a rate hike by the US Federal Reserve have weighed on the index for much of the year. The big banks, including National Australia Bank, Commonwealth Bank of Australia and Westpac Banking Corp, skidded more than 1 percent, while Australia & New Zealand Bank eased 0.8 percent.