The ASX has closed higher with gains across the board even as a markets were rattled by a US airstrike that killed a top Iranian military commander.

The benchmark S&P/ASX200 index gained as much as 97.7 points in early trading before retreating after news of the strike, closing on Friday up 42.9 points, or 0.64 per cent, to 6,733.5

The broader All Ordinaries finished up 45.2 points, or 0.66 per cent, to 6,855.2 points.

Meanwhile, the Australian dollar has fallen back from recent five-month highs and is buying 69.60 US cents, from 70.01 US cents on Thursday.