The S&P/ASX200 rose 29.7 points on Wednesday, up 0.34 per cent, to 8,823 as the broader All Ordinaries gained 28 points, or 0.31 per cent, to 9.004.9.
Gold stocks led the charge as the precious metal topped $US4,130 ($A5,904) an ounce, while BHP and Rio Tinto advanced as copper hit five-week highs, buoyed by strong demand from China and depleted global inventories.
The basic materials sector did most of the heavy lifting, Vantage senior market analyst Hebe Chen said.
"However, eight of the 11 sectors finished in the red, leaving the advance narrow and showing that investor confidence remains fragile rather than firmly on the mend," Ms Chen told AAP.
"Persistently higher oil prices could eventually become a headwind by lifting operating costs, adding to inflation and weighing on global growth and risk appetite."
Oil prices clung to recent gains as the US and Iran continued to trade strikes, and as two Asia-bound Saudi oil tankers turned back in the Red Sea over threats from Yemen's Iran-aligned Houthis.
The retreat marked the disruption of a second major choke point for global energy supplies, which will likely ratchet up inflation expectations.
Woodside, Santos and coal miners all rallied, along with uranium producers led by Paladin Energy after its quarterly trading update beat guidance.
The heavyweight financials sector was the third sector to notch a positive day, eking a less than 0.2 per cent improvement, as three of the big four banks crept higher.
CommBank was the best of the bunch with a 0.7 per cent lift to $171.69, while NAB edged lower to $39.27.
Health care, consumer discretionaries and real estate stocks were the worst-performing segments, each down more than 1.4 per cent as clouds gathered above the price growth and interest rate outlook.
In company news, SkyCity Entertainment rallied after making a deal to sell the Grand Hotel in Auckland to narrow debts and improve its balance sheet.
Bunnings owner Wesfarmers shares fell more than two per cent after taking a final investment decision on its Mount Holland Lithium Mine expansion, alongside joint venture partner SQM.
The Australian dollar is buying 69.95 US cents, down from 70.18 US cents, as investors look to Thursday's jobs data for hints on the Reserve Bank's path ahead.
Consensus expects an increase of 15,000 jobs, with the unemployment rate tipped to remain steady at 4.4 per cent, IG market analyst Tony Sycamore said.
"A softer-than-expected result - particularly a rise in the jobless rate toward 4.6 per cent - would suggest the RBA has tightened enough," he said.
"Conversely, a strong jobs report would add to tightening risks."
ON THE ASX:
* The S&P/ASX200 rose 29.7 points, or 0.34 per cent, to 8,823
* The broader All Ordinaries gained 28 points, or 0.31 per cent, to 9,004.9
One Australian dollar trades for:
* 69.95 US cents, from 70.18 US cents at 5pm AEST on Tuesday
* 114.11 Japanese yen, from 114.06 Japanese yen
* 61.30 euro cents, from 61.44 euro cents
* 52.28 British pence, from 52.18 pence
* 120.20 NZ cents, from 119.71 NZ cents