Batsman Rahmat Shah Thursday became the first Afghanistan cricketer to score a Test century, helping the minnows start strongly against Bangladesh on the opening day of the one-off match.
Shah made 102 and put on a crucial 120-run fourth-wicket stand with Asghar Afghan, batting on 88, to counter the Bangladesh spin attack at the Zahur Ahmed Chowdhury Stadium in Chittagong.
Afghanistan were 271 for five at stumps with Afghan and Afsar Zazai, on 35, putting together a 74-run partnership in the final session of play.
But it was Shah and Afghan who ensured that Afghanistan fought their way back in to the contest after being in trouble at 77 for three at lunch.
Taijul Islam and Nayeem Hasan took two wickets each to hurt Afghanistan after the tourists elected to bat first in just their third five-day game.
The war-torn nation had a bruising introduction to Test cricket after India outplayed them inside two days in 2018.
Afghanistan registered their first Test victory against Ireland early this year with Shah scoring two fifties in the game including a 98 in the first innings.
The top-order batsman extended his prolific run of form as he reached his hundred with a boundary off Hasan, raising his bat to a standing ovation from the crowd and the dressing room.
His celebration though was shortlived as Hasan got the batsman, who hit 10 fours and two sixes in his 187-ball knock, out on the next ball.
Hasan struck again with his off spin three balls later in the same over, rattling the stumps of Mohammad Nabi for nought as Afghanistan slipped to 197 for five.
Afghan, who survived a reprieve on 42 by TV umpire after being given leg before out off Mehidy Hasan, struck three fours and two sixes so far in his second Test fifty.
In the first session Taijul bowled opener Ihsanullah Janat for nine with his left-arm spin and became the fastest Bangladeshi bowler to reach 100 Test wickets.
Taijul, who finished the day with 2-73, also became the third Bangladeshi bowler after Shakib Al Hasan and Mohammad Rafique to achieve such a feat in the longer format in his 25th match.
Off-spinner Mahmudullah chipped in when he forced Hashmatullah Shahidi to give a catch to Soumya Sarkar at slip for 14 in his first over.
Bangladesh fielded an all-spin attack without picking a single pace bowler while Afghanistan handed a Test debut to Ibrahim, Qais Ahmed and Zahir Khan.
Afghanistan skipper Rashid became the youngest ever Test captain at the age of 20 years 350 days with the toss, overtaking the record of Zimbabwe's Tatenda Taibu, who made his debut as Test captain just eight days older than Rashid in 2004.