Pakistan thwarted a spirited career-best century by Danushka Gunathilaka to defeat Sri Lanka by five wickets in the third and final one-day international in Karachi on Wednesday, taking the three-match series in the process.

Gunathilaka's 134-ball 133 lifted Sri Lanka to a challenging 297-9 in their 50 overs but Pakistan chased down the target in 48.2 overs for their first series win in 15 months.

Pakistan won the second match by 67 runs while the first match was rained off without a ball being bowled -- both also in Karachi.

Pakistan were indebted to Fakhar Zaman (76) and Abid Ali (74) who provided a solid 123-run opening stand in 20 overs before Haris Sohail (56) and Iftikhar Ahmed chipped in with a 22-ball 28 not out.

"It wasn't an easy target but thanks to Abid and others who showed positive intent, they helped us chased it down," said Pakistan skipper Sarfaraz Ahmed.

Sri Lanka skipper Lahiru Thirimanne praised his young team who had been depleted by the withdrawal of 10 top players due to security fears in Pakistan.

"I am really happy with this team's performance," said Thirimanne. "We scored a good total of 297 but then did not execute our plans in the first ten overs of bowling.

"Overall I am happy with the team and the arrangements in Pakistan and will encourage other teams to come here and play."

Pakistan needed 37 in the last five overs as Iftikhar cut loose, hitting a six and a boundary to bring up victory -- Pakistan's eighth consecutive ODI win over Sri Lanka since 2017.

Sohail and Iftikhar hit three fours and a six apiece.

Abid drove 10 well-timed boundaries in his 67-ball innings and looked set for his second hundred in his fourth ODI before he was trapped leg-before by spinner Wanindu Hasaranga.

Zaman hit seven fours and a six in his 91-ball knock before becoming paceman Nuwan Pradeep's first of two wickets for 53 runs.

Babar Azam, who struck a brilliant hundred in the second game, made 31 before being trapped lbw by Pradeep skipper Sarfaraz managed 23.

The matches revived one-day international cricket in Karachi after a gap of ten years.

International teams had mainly stayed away from Pakistan following the deadly attacks on the Sri Lankan team bus in 2009.

Pakistan did not stage international cricket for six years before Zimbabwe toured in 2015 followed by visits from a World XI, Sri Lanka and the West Indies.

Gunathilaka stars for Sri Lanka

Earlier, Gunathilaka anchored Sri Lanka's innings after they won the toss and batted.

The 28-year-old left-hander hit 16 fours and a six for his second ODI hundred.

Gunathilaka, suspended twice for breaches of discipline in the last two years, held the innings together with stands of 88 with Thirimanne (36) for the second wicket, 50 for the third with Angelo Perera (13) and 74 with debutant Minod Bhanuka (36) for the fourth.

He was finally dismissed in the 45th over, bowled by paceman Mohammad Amir who was the best Pakistani bowler with 3-50.

It was Amir who gave Pakistan an early breakthrough when he had Avishka Fernando caught behind for four by Sarfaraz who was leading Pakistan for the 50th time in an ODI.

Gunathilaka defied Pakistan's bowling with guts and determination, improving his previous ODI best of 116 he made against Zimbabwe at Hambantota in 2017.

Thirimanne hit four boundaries off 54 balls while Bhanuka had two sixes in his 39-ball knock.

All-rounder Dasun Shanaka hit a 24-ball 43 with five fours and two sixes as Sri Lanka added 50 in the last five overs.

The two teams will now play three T20 internationals -- all in Lahore -- on October 5, 7 and 9.

Feature Image Courtesy: AFP/ Rizwan Tabassum