Bangladesh 265 (Tamim 80, Mahmudullah 62, Shakib 48, Dawlat 4-73, Rashid 2-37, Nabi 2-40) beat Afghanistan 258 (Hashmatullah 72, Shahidi 71, Shakib 2-26, Mashrafe 2-42, Taskin 2-55) by seven runs
Scorecard and ball-by-ball details

Bangladesh were given a mighty scare, but they somehow managed to fend off Afghanistan's challenge to win by seven runs in a tense first ODI in Mirpur. The 1-0 lead was possible through fine slog-overs bowling from Shakib Al Hasan, Taskin Ahmed and Rubel Hossain, who picked up seven wickets between them.

Afghanistan were cruising at 190 for 2, with Rahmat Shah and Hashmatullah Shahidi driving their chase in a 144-run third-wicket stand. Once that was broken, with Shakib having Rahmat stumped to become the country's highest ODI wicket-taker, things fell apart.

With 28 runs needed off 24 balls, Shakib kept the game within Bangladesh's reach through a tight one-run over. Taskin followed it up with a two-wicket over that included the scalp of Mohammad Nabi, who had made 30 off 24 balls, off a slower ball. Rubel then gave away eight runs and removed Rashid Khan off the last ball of the next over.

It boiled down to 13 off the final over, bowled by Taskin. With the new ball, he was wayward and perhaps a touch nervous upon his return to international cricket after getting his bowling action cleared by the ICC. Now, it was a do-or-die situation, and he responded by removing Mirwais Ashraf with a full delivery off the second ball. He then took his fourth wicket to finish a hard-fought win that could have belonged to Afghanistan had they kept their cool in the last half hour.

That they were in with a chance was largely because Bangladesh missed an opportunity to post much more than 265; they lost their last seven wickets for 62, with Mahmudullah's slog sweep that was caught at deep square-leg in the 41st over triggering the slide.

Mushfiqur Rahim and Sabbir Rahman then fell to Rashid Khan's googlies, leaving Shakib with the task of manoeuvring the final stages of the innings; he eventually fell for a 40-ball 48 in the 48th over. Dawlat Zadran, who was inconsistent in the middle overs, returned to finish with 4 for 73 off 10 overs, while Rashid and Nabi took two wickets each.

Bangladesh's platform was built by Tamim Iqbal, who made 80 off 98 balls with nine boundaries. His 83-run second-wicket stand with Imrul Kayes helped them recover from the early loss of Soumya Sarkar.

Tamim, who was dropped on 30 at point off Ashraf, then added 79 runs for the third wicket with Mahmudullah, before an unusual middle-overs slowdown, largely due to the oppressive heat and the slow nature of the surface. He eventually holed out to long-off in the 36th over. Mahmudullah too was given a reprieve on 58 by Afghanistan captain Asghar Stanikzai at cover, but he added just four more. He hit five fours and two sixes in all to give the total a lift.

Afghanistan's chase didn't take off until Mohammad Shahzad cut loose - he struck Taskin for three successive fours in the sixth over and flicked Mashrafe Mortaza for a six over midwicket - but his dismissal in the seventh over pulled them back. Mashrafe had the last laugh when he found the edge. What followed was an angry send-off, which was perhaps because of the pressure Bangladesh found themselves under all of a sudden.

Shakib struck two balls later to trap Shabir Noori lbw to become Bangladesh's joint-highest wicket-taker in ODIs along with Abdur Razzak. He could have taken over the record in the 12th over, but Mushfiqur Rahim couldn't gather a difficult take down the leg-side off Shahidi.

Rahmat and Shahidi then rebuilt to bring Afghanistan back into the contest. Once they found a string of boundaries, the confidence showed. Afghanistan signalled intent when Rahmat struck three sixes, over mid-off and midwicket, the third a beautiful pick-up off Rubel Hossain in the 31st over. He even scooped Rubel past fine-leg to leave the 40,000-strong crowd worried.

To add to Bangladesh's woes, Shahidi was let off for the second time when Mahmudullah failed to hold on to a chance at deep square-leg in the 40th over off Taijul Islam. Fortunately for Bangladesh, another opportunity came in the next over, which they gleefully accepted as Shakib broke the record for most ODI wickets. Rahmat's stumping on 71 ended a stand that, in hindsight, may have proved to be the game-changer.

Shahidi then mistimed a slog on 72 and was caught by Soumya Sarkar at deep midwicket in the 44th over. From there on, it was over to Nabi and Asghar Stanikzai to pull off a heist. But on the face of some improved death bowling, the task proved a little too steep. And in a jiffy, an opportunity to record a famous win slipped by.

Mohammad Isam is ESPNcricinfo's Bangladesh correspondent. @isam84