Chasing a target of 183 runs, Pakistan got off to a blistering start as openers Sahibzada Farhan and Fakhar Zaman smashed 54 runs in the first five overs.
With Pakistan at 54-1, Farhan was joined by Maaz Sadaqat after Fakhar (21 off 13 balls) was dismissed by Eshan Malinga. The pair added 92 runs for the second wicket, with both batters scoring freely.
Sadaqat scored 50 off 29 balls, hitting three sixes and four fours before being trapped lbw by Maheesh Theekshana.
Sri Lanka struck back with three quick wickets as Pakistan slipped from 144-1 to 156-4 in the 16th over.
Hasan Nawaz and Saim Ayub failed to make an impact, falling to Dushmantha Chameera and Theekshana, respectively.
Farhan, who brought up his half-century off 33 balls, went on to score 89 off 53 deliveries, steering Pakistan towards victory in the 19th over. The skipper struck four sixes and 10 fours before being dismissed with just four runs needed.
Shadab Khan, who came in at number seven, was also dismissed before Khawaja Nafay and Mohammad Imran guided Pakistan to victory.
For Sri Lanka, Maheesh Theekshana and Eshan Malinga claimed two wickets each, while Dushmantha Chameera and Nuwan Thushara took one wicket apiece.
Pakistan took a 1-0 lead in the three-match T20I series, with the remaining matches scheduled to be played at the same venue on October 11 and 13.
Earlier batting first after winning the toss, the visitors made a shaky start, losing two wickets for just 18 runs in the fourth over. Naseem Shah struck in the opening over, dismissing Kusal Mendis for just one run.
Kamil Mishara also fell cheaply, scoring six runs before debutant Muhammad Imran sent him back to the pavilion.
Opener Lahiru Udara and Kamindu Mendis then steadied the innings with a 60-run partnership for the third wicket.
Saim Ayub broke the stand in the 10th over, dismissing Kamindu Mendis for 23 off 18 balls, including four boundaries.
Imran struck again in the following over, removing Sahan Arachchige to leave the visitors at 83-4 after 10.1 overs.
Udara and Dasun Shanaka then added 57 runs off 34 balls for the fifth wicket.
Udara then combined with the lower-order batters to push Sri Lanka past 170 before Naseem ended his impressive knock.
Dushmantha Chameera and Eshan Malinga scored 10 runs in the over as the visitors posted 182-8 in 20 overs.
For Pakistan, Naseem picked up three wickets for 36 runs in four overs while Imran finished with a figure of 2-2.
Saim, Abrar, and Razaullah also took a wicket each. Pakistan also conceded 26 extras.

