By virtue of the win, Australia moved to the second spot in Group 1 with seven points from five games, same as New Zealand, who became the first team to qualify for the semifinals on account of a better net run rate.
Australia, however, failed to get past England’s net run rate as the hosts needed to restrict Afghanistan below 106 after posting 168 for eight.
That means if England beat Sri Lanka in Sydney in their final game on Saturday, they too will finish with seven points and will join New Zealand in the semifinal from Group 1 with a better net run rate.
Glenn Maxwell was the top-scorer for Australia as he hit a quickfire fifty but Afghanistan pulled things back nicely in the final five overs to limit the defending champions to a decent total.
Maxwell made an unbeaten 32-ball 54 that included six boundaries and two hits over the fence after Afghanistan invited Australia to bat.
In response, Afghanistan nearly pulled off a sensational win, riding on Rashid’s (48 not out off 23 balls) pyrotechnics but eventually fell short.
Rahmanullah Gurbaz got Afghanistan’s chase off to a decent start with a 17-ball 30 during which he struck two boundaries and as many sixes but Australia forged their way back, removing both the openers.
Gulbadin Naib (39) and Ibrahim Zadran (26), however, were in no mood to give up without a fight and stitched 59 runs off 46 balls for the second wicket.
Both Naib and Zadran used the inside out shots over the infield to good effect and kept the Afghans in the hunt.
It took a brilliant piece of work from Maxwell from the outfield to break the stand. Maxwell came up with a direct hit from deep mid-wicket to cut short Naib’s innings and then in the very next ball Zadran top-edged Adam Zampa to Marsh.
Zampa inflicted another missed timed shot to dismiss Najibullah Zadran as Afghanistan lost the plot in the 14th over.
Towards the end, Rashid played some lusty blows and together with Darwish Rasooli shared quick 45 runs off 28 balls to reduce the equation to 22 of the last over.
Rashid managed to hit Marcus Stonis for two fours and one six in the final over but it was not enough.
Earlier, Australia lost Cameroon Green early but David Warner (25 off 18) and Mitchell Marsh (45 off 30) kept up the run rate up with their fiery strokeplay.
But two quick wickets in the sixth over in the form of Warner and Steve Smith saw the hosts slump to 52 for 3 in the powerplay.
While Warner was bowled by a Naveen-ul-Haq off-cutter as the batter went for an extravagant switch hit, Smith was adjudged LBW three balls later.
Marsh then top-edged Mujeeb Ur Rahman (1/42) while going for a slog sweep and Gurbaz took a fine high catch to sent the batter packing as Australia were reduced to 86 for 4 in the 11th over.
Maxwell and Stoinis (25 off 21) then joined hands and shared 53 runs off just 29 balls for the fifth wicket.
While Maxwell looked in ominous form, cutting, pulling and lofting Afghan bowlers over the boundary, Stoinis struggled with his timing.
Stoinis had just two sixes during his 21-ball knock before he handed a simple catch to Usman Ghani at backward point off Rashid.
Stand-in captain Matthew Wade too didn’t trouble the scorers much as he was cleaned up by Fazalhaq Farooqi’s toe-crushing yorker.
From 133 for 4 in 15 overs, Australia kept on losing wickets to lose the momentum as Maxwell found boundaries hard to come by after a promising start.
Maxwell brought up his fifty off 29 balls with a four off Farooqi in the final over and found the fence again in the last ball to finish the innings on a high.
Adelaide, Nov 4: Defending champions Australia survived a late Rashid Khan onslaught to eke out a narrow four-run win over Afghanistan and keep their slim semifinal hopes alive in the T20 World Cup here on Friday.