The spectators at Sheikh Zayed Stadium were given a nail-biting, edge of the seat thriller to witness as Pakistan pulled a last over victory over a spirited Afghanistan side.
Imam-ul-Haq was run out in the 34th over but had managed to score 80 from 104 balls (his second ODI fifty) as Babar Azam too followed him within two overs.
In the group stage at the Asia Cup 2018, Pakistan opened their campaign by defeating Hong Kong.
Pakistan were off to a disastrous start when opener Fakhar Zaman was trapped leg-before off the sixth ball of the innings by spinner Mujeeb Ur Rahman for nought.
Shahidi shifted gears easily after largely remaining patient in his unbeaten and career-best knock which came off 118 balls. Afghanistan are 101/3 in 26 overs.
Malik with calm and composed batting eventually trumped the inexperience in the Afghanistan team, as he took Pakistan home with three balls to spare.
Shahidi finished with a brilliantly-paced 118-ball 97 not out, and added 94 for the fourth wicket with his skipper Asghar Afghan, who smashed five sixes and two fours in his 56-ball 67.
India beat Bangladesh by seven wickets in Dubai and now meet Pakistan on Sunday, also in Dubai. In the league stage, Afghanistan played an fantastic game to knock out Sri Lanka.
Pakistan lost Haris Sohail (13), Sarfraz Ahmad (8), Asif Ali (7) and Mohammad Nawaz (10) with Afghan bowlers fighting hard.