But the tempting target looked increasingly challenging when Pakistan slumped to 24-4 in the chase.
Mustafizur Rahman bowled Mohammad Rizwan for 11 and Taskin Ahmed removed Babar Azam for seven as Bangladesh put Pakistan under pressure at the start of their innings.
Haider Ali and Shoaib Malik both went for ducks, the former plumb leg before and wicketkeeper Nurul Hasan showing presence of mind to run out the latter.
Malik was strolling outside his crease after conceding a dot ball when Hasan threw it back onto the stumps, and replays showed the veteran campaigner was late to ground his bat.
But Fakhar Zaman and Khushdil Shah put them back on track with a stand of 56 for the fifth wicket, both of them accumulating knocks of 34 runs.
When Shah fell Pakistan still needed 32 runs off 3.1 overs but Shadab Khan and Mohammad Nawaz saw them home with some lusty blows late in the innings.
It was Khan who struck the winning six to take them to 132-6 with four balls to spare, leaving him unbeaten on 21 runs off 10 balls.
"Credit to the middle order, the way they showed the skills. Fakhar, Khushdil, the way Nawaz finished," said Pakistan captain Babar Azam.
Bangladesh skipper Mahmudullah Riyad was sanguine about his choice to bat first.
"When we chose to bat, it looked a good wicket. But there was help for the bowlers as well. It's not an excuse," he said
The second match of the series will be held at the same ground on Saturday.