Bangladesh 249 for 7 (Mahmudullah 74, Kayes 72*, Alam 3-54) beat Afghanistan 246 for 7 (Shahidi 71, Shahzad 53, Mustafizur 2-44) by three runs

Manjrekar: The temperament of Mustafizur beat Afghanistan

Mustafizur Rahman defended seven runs off the last over against Afghanistan as Bangladesh set up a virtual knockout clash against Pakistan on Wednesday. As impressive as Afghanistan had been in the Asia Cup, they are out of the tournament having failed in their first chase, which was their second straight loss in the Super Fours.

After conceding two off the first ball, a cramping Mustafizur had Rashid Khan caught and bowled before Samiullah Shenwari and Gulbadin Naib managed only two leg-byes from the last four balls. When Afghanistan needed four of the last ball, Shenwari's bat flew out of his grip as he swung and missed Mustafizur's short ball. The key moment in the closing stages was Mohammad Nabi's dismissal in the penultimate over as he had already struck two fours and two sixes in his 28-ball 38.

While Mustafizur lived up to his billing as one of the best finishers with the ball in the world, it was Mahmudullah's timely 74 which got Bangladesh to a competitive 249 for 7 in 50 overs. He earned the Player-of-the-Match award after he also took the crucial wicket of Mohammad Shahzad, and a great catch to dismiss Afghanistan captain Asghar Afghan, who had added 78 runs for the fourth wicket with Hashmatullah Shahidi, who reached his third fifty in a row.

Afghanistan had to recover from a poor start after Ihsanullah fell in the fifth over. Shakib Al Hasan then scored only Bangladesh's third direct-hit run-out in the last 12 months as Rahmat Shah was caught short after he was sent back by Shahzad in the eighth over.

Similar to Bangladesh, Afghanistan's third-wicket pair of Shahzad and Shahidi added 63 runs to pull them out of early trouble. Shahzad, who was dropped on 9 when the skier ended up hitting Mohammad Mithun's head after it slipped through his fingers, faced his usual problem of rotating the strike. He gave away 54 dot balls but still eked out a half-century. Mahmudullah then bowled him with an arm ball as Shahzad backed away to cut the ball, after Afghanistan had gone through without a boundary for the previous 23 balls.

Afghan and Shahidi then focused on scoring singles rather than playing up dot balls. They broke a boundary duck of 61 balls in the 31st over, before Shahidi reached his fifty in the 36th over. He celebrated the mark with a superb pull shot off Mustafizur off the following delivery. That stand ended when Afghan, after hitting Mashrafe for a four down the leg side, top-edged to short third man for 39 with more than 10 overs left. Shahidi fell trying to lap-sweep Mashrafe in the 44th over, with his side still requiring 58 off the remaining 39 balls.

Bangladesh's innings could have gone pear-shaped like their last two matches but for the 128-run stand between Mahmudullah and Imrul Kayes, who had only flown in the previous day as a squad reinforcement. They broke the Bangladesh record for the sixth wicket, previously held by the 123-run stand between Khaled Mashud and Al Sahariar in 1999.

They only struck two boundaries till the 30th over when Bangladesh's run rate was only a tad above four an over. They continued to rely mostly on singles and doubles in the next 10 overs too, hitting only two more fours. Mahmudullah finally launched Rashid for two sixes in two overs, both slog-swept over midwicket.

Kayes, who was batting at No. 6 for the first time in his international career and playing his first ODI in 11 months, also put a lot of emphasis on picking up singles rather than hitting fours. He struck only three fours in his first 82 balls but once Mahmudullah got out in the 47th over, Kayes struck three more fours as Bangladesh added 77 runs in the last 10 overs.

They had earlier slipped to 87 for 5 in the 21st over, soon after Mushfiqur Rahim and Liton Das had added 63 runs for the third wicket. After Liton had moved to 41 with an inside-out shot over cover off Rashid, his attempted slog-sweep next ball ended up as an easy skied catch to slip. Later in the same over, Shakib was run-out after a mix-up with Mushfiqur, who then ran himself out after a mix-up with Kayes in Rashid's next over; Bangladesh lost three wickets in 14 balls, from being 81 for 2 in the 19th over.

But Mahmudullah, Kayes and Mustafizur made important contributions to keep their team in the competition with a last-ball win.

Mohammad Isam is ESPNcricinfo's Bangladesh correspondent. @isam84