
Australian shares have posted a fourth straight month of gains, but a final session rally largely crumbled as investors took profits ahead of a historically weak period for the exchange.
The S&P/ASX200 jumped 92 points in early trade but ended Friday's session just 9.1 points higher, up 0.1 per cent, to 8,976.8, as the broader All Ordinaries gained 14.3 points, or 0.16 per cent, to 9,137.
July has historically been the Aussie market's strongest month, with an average gain of 2.7 over the past decade, while September tends to be its weakest with an average loss of one per cent.

Recent gains had been supported by new financial year inflows, a brighter interest rate outlook following a cooler-than expected inflation print, and strong Rio Tinto earnings, IG market analyst Tony Sycamore said.
"We've also seen the index benefiting from that safe haven low-beta nature, which the ASX 200 holds in more volatile times, particularly while the Asian indices have been absolutely whirring around," Mr Sycamore told AAP.
South Korea's semiconductor-dominated KOSPI index soared a record nearly 17 per cent, rebounding from a recent sell-down, after renewed confidence in the artificial intelligence trade snapped Wall Street's tech-heavy Nasdaq out of a brief technical correction overnight.
Mining stocks did much of the heavy lifting on Friday, as the basic materials sector improved 1.4 per cent, while IT stocks, energy and real estate trusts also carved out gains.
Artificial intelligence infrastructure plays Megaport and NextDC were some of the best performers, up 11.5 per cent and 4.5 per cent respectively.
Given Australia's limited exposure to advanced technology stocks, the materials segment was acting as a local proxy to the AI trade as investors hunted exposure to copper, Global X ETFs strategy analyst Joseph Marassa said.
"Rio Tinto and Capstone Copper both set a strong benchmark over the week, attention now turns to whether the rest of corporate Australia can justify the market's renewed optimism as earnings season unfolds,” he said.
August reporting season officially kicks off next week, with AMP, REA Group, ResMed and James Hardie among the names handing down results.

Despite energy supply and price disruptions stemming from the US-Iran conflict, analysts expect a strong half for earnings growth, although many predict gains will be concentrated in miners and the financial sector.
Oil prices eased on Friday, despite reports of drone strikes on tankers in Egyptian waters raising concerns the Suez Canal could become the third major crude route disrupted by broadening attacks.
The heavyweight financials sector crept lower on Friday but notched a fifth straight week of gains after coming within striking distance of all-time-highs on Wednesday.
Consumer facing stocks also had a positive week, as they continue to cling to recent gains after rallying from May lows.
The Australian dollar is buying 70.33 US cents, up from 69.54 US cents on Thursday at 5pm.
ON THE ASX:
* The S&P/ASX200 rose 9.1 points, or 0.1 per cent, to 8,976.8
* The broader All Ordinaries advanced 14.3 points, or 0.16 per cent, to 9,137
One Australian dollar trades for:
* 70.33 US cents, from 69.54 US cents at 5pm AEST on Thursday
* 112.72 Japanese yen, from 113.78 Japanese yen
* 61.06 euro cents, from 60.75 euro cents
* 52.28 British pence, from 52.11 pence
* 119.77 NZ cents, from 119.70 NZ cents