Overnight batsman David Warner struck a belligerent 112 and added 130 runs with skipper Steve Smith but their efforts went in vain as the hosts took a 1-0 lead in the two-match series.
Chasing 265 to win, Australia lost five wickets in an eventful morning session, and whatever hopes they had were snuffed out when Shakib bowled Glenn Maxwell with the first delivery after the lunch break.
Pat Cummins scored an unbeaten 33 down the order to inject some drama but it was not enough in the end as Australia were all out for 244.
Shakib (5/85) celebrated his 50th Test appearance by scoring 84 in the first innings and finishing with a 10-wicket match haul, a performance worthy of his status as the world's top-ranked Test all-rounder.
Resuming on 109/2, Warner batted with calculated aggression, while Smith was content to play second fiddle as they continued the good work they had started on Tuesday evening with some generous assistance from Lady Luck.
Warner survived a review before the southpaw brought up his 19th Test century, a second in Asia. Then, when the opener was on 106, he pulled a Shakib delivery and the ball flew past leg-slip before the fielder could put his hands together.
Smith was on 28 when Tamim Iqbal spilled him at mid-on but Shakib (4/68) was lurking round the corner with his left-arm spin to change the complexion of the match.
Shakib first trapped Warner leg-before for 112 and, four overs later, had Smith caught behind for 37 to pile the pressure back on Australia.
On a turning track where their frontline batsmen have struggled against Bangladesh's three-pronged spin attack, Peter Handscomb, Matthew Wade and Ashton Agar all fell in quick succession prior to lunch.
Cummins hit a couple of sixes in his aggressive innings but ran out of partners after Taijul Islam trapped Josh Hazlewood leg-before.
Australia will slip one place to fifth in the test rankings even if they level the series by winning the second test in Chittagong from Monday. A second defeat would see them lose another place.
Bangladesh vs Australia 2017Bangladesh vs Australia First TestDavid WarnerGlenn MaxwellMehedi HasanMushfiqur Rahimshakib al hasansteve smithtaijul islam
First Published: August 30, 2017, 1:45 PM IST