The sharemarket rose 1 per cent as the military overthrow of Egyptian President Mohammed Mursi boosted the price of crude oil and shares in energy companies.
The strong gains marked another day of market volatility, with shares shifting between big losses and big gains each day this week.
The benchmark S&P/ASX 200 Index gained 50.6 points, or 1.07 per cent, to 4794.7. The broader All Ordinaries Index added 53.2 points, or 1.13 per cent, to 4781.
On the ASX 24, the September share price index futures contract was 47 points higher at 4754, with 17,124 contracts traded.
CommSec market analyst Juliette Saly said energy companies were the standout performers on Thursday as crude oil prices stayed above $US100 a barrel following Mr Mursi's detention.
"That's exactly why we saw the oil price hit that 14-month high overnight - but also due to the fact we saw an increase in US stockpiles," she said. "Pretty much every sector was higher today. We did see a little bit of a switch out of info-tech but generally you can put a lot of the good work down to the great gains we saw coming through from the energy sector."
Woodside Petroleum was up $1.02, or 2.95 per cent, at $35.64, Oil Search gained 12¢ to $7.88 and Santos was also up 12¢ at $12.97.
The miners rose following gains in iron ore prices on Wednesday night, which lifted to $US120 a tonne. BHP Billiton gained 17¢ to $31.22, Rio Tinto improved 67¢ to $52.17 and Fortescue was 21¢ higher at $3.30.
Commonwealth Bank lost 6¢ to $68.47, while its rivals gained between 0.5 per cent and 1.15 per cent. The spot price of gold in Sydney finished at $US1252.50, up $US6.60 from Wednesday's close of $US1245.90.
The dollar was higher after a comment from Reserve Bank governor Glenn Stevens that caused the currency to fall to a three-year low was dismissed as a light-hearted remark.
At 5pm on Thursday it was trading at US91.06¢, up from US90.62¢ on Wednesday.
Mr Stevens told a business function on Wednesday that the RBA had deliberated for "a very long time" before deciding to leave the cash rate at its record low of 2.75 per cent on Tuesday.
The unscripted comment sent the Australian dollar below US91¢ and to its lowest level since September 2010.