Gritty Bangladesh set up a final clash with India in the Asia Cup after stunning Pakistan by 37 runs in the last Super Four match, riding on Mushfiqur Rahim's valiant 99 here.
Mushfiqur notched up his 30th half-century, while Mohammad Mithun made 60 to lift Bangladesh to a decent 239 all out from a precarious position after skipper Mashrafe Mortaza opted to bat in the virtual semifinal on Wednesday night.
Mushfiqur was unlucky as he fell one short of what could have been his seventh ODI century but did enough to rescue Bangladesh with a 144-run fourth wicket stand with Mithun after they were reduced to 12 for three inside five overs.
Later, opener Imam-ul-Haq (83) turned out to be the lone bright spot for Pakistan as they faltered in pursuit of the modest chase and were restricted to 202 for nine.
Bangladesh will now take on India in the title clash in Dubai on Friday.
Just like Bangladesh, Pakistan's chase got off to a disastrous start as they were reduced to 18 for three in 3.3 overs.
But Imam did not give up the fight and stitched two crucial partnerships with Shoaib Malik (30) and Asif Ali (31) to keep Pakistan in the hunt.
Imam first stitched 67 runs for the fourth wicket with Malik and then shared crucial a 71-run partnership with Ali to keep Pakistan's hopes alive.
But the day belonged to Bangladesh as they never gave up hope and fought tooth and nail to stay one step ahead of Pakistan in the match.
Pakistan did not have the best of starts as they lost Fakhar Zaman, Babar Azam and skipper Sarfraz Ahmed early.
Left-arm pacer Mustafizur Rahman (4/43) and off-spinner Mehidy Hasan (2/28) did the early damage for Bangladesh.
But the turning point of the match was Bangladesh skipper Mashrafe Mortaza's blinder of a catch at midwicket to remove Malik off Rubel Hossain's bowling in the 21st over.
Mortaza dived full length to his left to latch on to a screamer as Malik went for a chip over midwicket.
That was the trigger that Bangladesh needed as they bowled and fielded brilliantly inside the circle to frustrate the Pakistani batsmen.
Imam and Ali raised some visions of a victory with their 71-run stand but dismissal of both the batsmen in quick succession derailed Pakistan's chase.
Earlier, Bangladesh too were off to a horrendous start as they lost their first three wickets with the scoreboard reading just 12 in 4.2 overs.
Left-arm pacer Junaid did the early damage, removing openers Liton Das and Soumya Sarkar in his consecutive overs.
One-down Mominul Haque failed once again as he was cleaned up by young left-arm fast bowler Shaheen Shah Afridi (2/47) in the fourth over.
But Bangladesh's go to man in crisis situations, Mushfiqur once again came to his side's rescue and in Mithun's company first stabilised the rocking ship and in the process brought up the century stand in 176 deliveries.
In dire need of a partnership, the duo started cautiously and grew in confidence as the match progressed.
Both Mushfiqur and Mithun punished the bad deliveries that came their way.
But just when the partnership was looking dangerous, Pakistan got the vital breakthrough in the form of Mithun who was caught by Hasan Ali (2/60) off his own bowling in the 35th over.
Mithun's second fifty of his career came off 84 balls with the help of just four boundaries.
Imrul Kayes (9) looked shaky from the onset and didn't last long, falling LBW to leg-spinner Shadab Khan (1/52).
The diminutive Mushfiqur, however, went about his business with a calm head and looked set for a well-deserved century but luck was not on his side as he sneaked a good length delivery from Afridi to Sarfraz Ahmed just one short of the three-figure mark.
Mushfiqur scored his runs off 116 balls with the help of nine fours.
Towards the end Mahmudullah (25) and skipper Mashrafe Mortaza tried to use their long handle to maximum effect to take Bangladesh beyond the 250-run mark.
For Pakistan, comeback man Junaid Khan shone with the ball, registering impressive figures of four for 19 from his nine overs.