Sri Lanka needed a little over 26 overs to chase down a 153-run victory target for a series-levelling seven-wicket victory in the second Test against Pakistan on Monday.
Dimuth Karunaratne (50) helped Sri Lanka get off to a flying start before adding 72 runs for the third wicket with skipper Angelo Mathews, who remained not out after a responsible knock of 43.
Karunaratne fell soon after bringing up his sixth Test fifty, becoming leg-spinner Yasir Shah's second victim, but Lahiru Thirimanne (20 not out) scored the winning boundary to take them home at P Sara Oval.
Eager to wrap up the victory, Sri Lanka promoted Kithuruwan Vithanage (34) to the opener's slot and the batsman's quickfire 23-ball cameo set the tone for a successful chase.
"We wanted to bat positively because we never know when the rain is going to come," Mathews said at the presentation ceremony.
"So we wanted Kithuruwan to go out and express himself. We gave him the green signal to take the bowlers on.
"We approached it in a very positive way, you can't get bogged down and let the bowlers get on top. We just wanted to play positive cricket."
After heavy rain had washed out Sunday's entire final session and delayed the final day's start, Vithanage signalled his team's intention by hitting the first ball of the day for a boundary.
He then clobbered left-arm spinner Zulfiqar Babar for back-to-back sixes before Sri Lanka lost two wickets in two balls to find themselves in a spot of bother.
Vithanage perished trying to slog-sweep Babar over midwicket with Mohammad Hafeez taking the skier.
Yasir Shah then dismissed the retiring Kumar Sangakkara for a golden duck with a delivery that hit the batsman's glove and thigh pad en route to Azhar Ali's hands at short leg.
With the threat of rain looming large and groundsmen ready to rush in with the covers, Karunaratne and Mathews kept scoring briskly.
Karunaratne completed his sixth Test 50 and was trapped leg before soon after by Shah, a decision the batsman instantly reviewed but could not get overturned.
Lahiru Thirimanne (20 not out) hit a boundary in the 28th over to seal the victory against Pakistan, who paid the price for their first innings batting capitulation at the P Sara Oval.
"The session from lunch to tea really dented us on the first day," Pakistan skipper Misbah-ul-Haq said, referring to their collapse for 138 runs.
"We lost all our best batsmen during that period. That was I think the main difference in the Test match."
The teams now move to Pallekele for the all-important third and final Test from Friday.
Sri Lanka lead by 166 runs after Shah takes five
1st Test: Shah stars as Pakistan thrash Sri Lanka
Sri Lanka need 153 to win after dour Azhar Ali ton
2nd Test: Shehzad, Ali power Pakistan to 171-2 vs Lanka
Shafiq, Sarfraz give Pakistan control against Sri Lanka