The sides will meet again on Friday to decide the series.
The hosts, beaten 2-0 in the recent T20 series, were chasing a target of 228 to win but were bowled out for 198
Afghanistan had already taken an unassailable 2-0 lead in the three-match series against Ireland
Hazratullah Zazai top scored with 82 from just 54 balls and was ably supported by captain Asghar Afghan's 37.
The tourists posted 160-7 batting first after rain had reduced the match to 18 overs a side.
Rahkeem Cornwall smacks 75 off 30 balls
Why PCB should not have reverted to Waqar Younis?
Misbah to give leeway to Umar Akmal
Waqar upbeat to start working
Mani assures no negative news from Sri Lanka Cricket
Sarfaraz urges Sri Lanka to tour Pakistan
Babar Azam elevated to vice-captain post
England crush Australia to level Ashes series 2-2
Nabi, Mujeeb propel Afghanistan to 12th consecutive T20I victory
PCB chairman Mani plays down concerns over Sri Lanka series