Pakistan beat Sri Lanka by four wickets in the opening one-day international in Hambantota.
Captain Angelo Mathews top-scored with 89 as the hosts made 275-7 in a match reduced to 45 overs due to rain.
However a career-high 89 from Sohaib Maqsood saw the visitors reach their target off the penultimate ball at the Mahinda Rajapaksa International Cricket Stadium.
Pakistan, who elected to field after winning the toss, limited their opponents to 36-1 at the end of the powerplay, which was interrupted by rain.
Sri Lanka were in deeper trouble at 75-4 in the 18th over, however, veteran Mahela Jayawardene and Mathews turned the innings around with a 116-run partnership for the fifth wicket.
Jayawardene, who retired from Test cricket earlier this month, hit eight fours in his 66-ball 63 before running himself out.
Mathews had brought up his 50 off 58 balls by that point and blasted nine fours and two sixes in his 85-ball knock, which came to an end in the penultimate over when he became a third victim for Wahab Riaz.
A late cameo from Ashan Priyanjan, who hit eight fours in the 15 balls he faced, lifted the Sri Lanka total—they scored 105 from the final 10 overs.
Pakistan made a promising start, putting on 39 for the opening wicket, but they slipped to 106-5 at halfway, with Ahmed Shehzad bowled through the gate by Thisara Perera one short of his half-century .
However, for the sixth wicket, Maqsood and Fawad Alam shared the highest partnership of the innings, with their stand of 147 coming off just 19.3 overs.
Alam was caught at third man off Lasith Malinga for 62, which saw Shahid Afridi come to the crease with 22 needed off 18 balls.
Afridi kept his composure and sliced Nuwan Kulasekara past point for a boundary to seal the dramatic win.
The three-match series continues in Hambantota on Tuesday.