Bangladesh 332 and 273 for 0 (Tamim 138*, Kayes 132*) trail Pakistan 628 (Hafeez 224, Azhar 83, Shafiq 83, Sarfraz 82, Taijul 6-163) by 23 runs

Scorecard and ball-by-ball details

The prospect of surviving five sessions under a heavy deficit against a potent bowling attack would have forced most sides into a shell. Ten years ago in Dhaka, Bangladesh had batted out 142 overs against Zimbabwe to force a draw and win their first Test series. Nafees Iqbal had knuckled down to score 121 in almost six hours in that match.

Faced with a daunting deficit of 296, Nafees' brother Tamim Iqbal, however, chose an alternative approach. He kept all diffidence aside in a blistering century - his third in three Tests, his seventh overall and his first against Pakistan - that helped Bangladesh slice off almost all of Pakistan's daunting lead in just over two sessions. Along with Imrul Kayes, who was close on Tamim's heels with his third Test century, he added 273 runs in 61 overs during an unbeaten stand that not only beat the record of Bangladesh's best opening set by the same pair in the the team's previous Test, it also was their best stand for any wicket.

If there was any help for the bowlers from the pitch, it remained buried deep under the solidity of the two batsmen. The ball reversed, but often found the middle of the bat; it turned, too, but was regularly carted away over the boundary ropes. Only twice, Pakistan came close to breaking the stand as Tamim was hit on the pads, but in both instances, the decision stayed with the umpire after Pakistan asked for a review.

It was a riposte Pakistan would have least expected after their continued dominance on the fourth morning. Even though left-arm spinner Taijul Islam ended with figures of 6 for 163 - his third five-for in sixth Test - as Pakistan lost their last five wickets for 34 runs, the damage had seemingly been done. Leading by 205 runs at the start of the fourth day, Sarfraz Ahmed and Asad Shafiq had extended the dominance with a 126-run stand for the sixth wicket. Both batsmen missed out on centuries but Pakistan's total propped up to 628, their best against Bangladesh.

The four overs Bangladesh had to play before lunch hid completely the approach they were going to take in the innings. Only six runs were scored after Tamim had narrowly survived an appeal for lbw off the first delivery from Junaid Khan. In the first over after lunch, though, Tamim carved the same bowler stylishly with a back-foot punch through backward point. In the next over from Wahab Riaz, Tamim picked up two consecutive boundaries with the pull shot.

If one thought it was a brief tactic to score quickly off the faster bowlers on a pitch that was still good for batting, before the arrival of spin, Tamim was to prove it wrong. He came out of the crease on the second ball bowled by Zulfiqar Babar but was lucky to mistime the lofted shot as it landed only couple of meters short of the fielder at deep midwicket. Had he holed out, his method would have surely been termed reckless.

A classic cover drive off Yasir Shah in the next over brought the 50 for Bangladesh, in 12.5 overs. The next 50 was even quicker; it came in 9.1 overs as Kayes joined in as well. Pakistan's spinners were constantly made to adjust their lengths as both batsmen jumped out of the crease without warning.

A reverse-swept boundary off Zulfiqar brought up Tamim's first fifty against Pakistan. The next ball disappeared over long-on. When brought on, Hafeez was served the same treatment, with Tamim smashing him down the ground for his second six in the bowler's second over and Kayes picking up a six and a four in his third to bring up Bangladesh's 100 in the 22nd over. When Tamim slowed down, Kayes picked up, reaching his half-century off 80 balls.

The pair tightened up in the third session, keeping the reverse-swing out, before a brace of boundaries off Junaid took Tamim to his fourth second-innings century off 123 balls. The innings put him ahead of Mohammad Ashraful on the list of Bangladesh batsmen with most centuries.

Kayes was equally impressive and adventurous. He had been squatting behind the stumps as a substitute wicketkeeper for more than 100 overs over the last couple of days after Mushfiqur had injured his right hand. Eight overs into the day, Kayes, in an act of self-preservation, passed on the gloves to Mahmudullah. That came in handy as he survived a bout of cramps to reach the century-mark off 153 balls with the help of 11 fours and three sixes. By the end of the day, he had caught up with Tamim.

It was a highly unlikely turn of events. But it was such a day. Earlier, Mahmudullah, who was keeping wickets for the first time in international cricket, was reminded of the job responsibilities by Sarfraz. The batsman blocked in front of the pitch and directed Mahmudullah to pick up the ball, but then went on himself to lob it towards the bowler. If Pakistan were expecting similar generosity from Bangladesh's batsmen, it never came.

Devashish Fuloria is a sub-editor at ESPNcricinfo