(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 .AXJO 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 BHP.AX and Rio Tinto (LON:RIO) RIO.AX , 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. O/R
Utility stock Origin Energy ORG.AX , 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. machine maker Aristocrat Leisure ALL.AX , 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 .AXFJ lost 9.2 percent on the month.
New Zealand's benchmark S&P/NZX 50 index .NZ50 ended flat as gains in financials offset losses in consumer stocks.
The benchmark finished higher for a fifth straight month this year.