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 target is 275 as per DL method, although Sri Lanka made 275/7 #SLvPak— Mohandas Menon (@mohanstatsman) August 23, 2014
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.
Most ODI matches: Tendulkar 463, Jayasuriya 445, Mahela Jayawardene 421*, Shahid Afridi 379*, Sangakkara 378*. Inzamam-ul-Haq 378. #SLvPak— Cricket Record (@cricinfo_record) August 23, 2014
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.
Wahab Riaz is the 27th player from Pakistan to reach 50 ODI wicket. #SLvPak— Cricket Record (@cricinfo_record) August 23, 2014
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.
1st ODI: Sri Lanka v Pakistan at Hambantota. Pakistan need 276 runs to win in 45 overs. pic.twitter.com/2BNP7TFNVT— PTV Sports Official (@PTVSp0rts) August 23, 2014
Pakistan Bowling summary after 45 overs. pic.twitter.com/Bjdybss29V— PTV Sports Official (@PTVSp0rts) August 23, 2014
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.
Pakistan batting card pic.twitter.com/sUu0YWg6NW— PTV Sports Official (@PTVSp0rts) August 23, 2014
The three-match series continues in Hambantota on Tuesday.