(Updates to close)
May 31 (Reuters) - Australian shares ended marginally higher on Wednesday as gains in the consumer and financial sectors offset losses in energy and materials stocks, which suffered from weak commodity prices.
The S&P/ASX 200 index closed up 0.1 percent at 5,724.60 points, to follow on from a 0.2 percent gain on Tuesday.
However, it shed 3.4 percent in May, a month marked by geopolitical uncertainty across the globe.
Mining majors BHP and Rio Tinto, lost 0.4 percent and 0.7 percent respectively. BHP was also hit by a slump in oil prices, which suffered as rising output from Libya added to concerns about increasing U.S. production undermining OPEC-led production cuts.
Utility stock Origin Energy, which has significant natural gas interests, pulled the sector down by falling nearly 3 percent.
However, sentiment was boosted earlier in the session by better than expected Chinese manufacturing data, which gave consumers stocks a lift.
Gaming machine maker Aristocrat Leisure, which reported solid half-year earnings last week, rose to a record high.
Australia's five big banks added to their gains from the previous session by rising in a range of 0.3 percent to 1.4 percent.
Earnings outlook for banks, however, remains bleak in the face of regulatory headwinds.
The financial index lost 9.2 percent on the month.
New Zealand's benchmark S&P/NZX 50 index ended flat as gains in financials offset losses in consumer stocks.
The benchmark finished higher for a fifth straight month this year. (Reporting by Rushil Dutta; Editing by Simon Cameron-Moore)