Azam finished with 103 from 131 deliveries for his sixth ODI hundred, as Malik smashed a 61-ball 81 as the pair added 139 for the fourth wicket after Sri Lanka had won the toss and opted to bowl first.
Malik joined Azam at 124-3 and smashed five fours and two towering sixes before holing out at deep midwicket off the last ball of the 47th over.
Azam completed his hundred off 128 balls in the next over with a single, but three runs later miscued a drive off paceman Suranga Lakmal, who finished with 2-47 from his ten overs.
Azam managed a poor 38 runs in the preceding 2-0 Test- series defeat but batted with guts to prove his credentials as a limited-overs batsman.
Pakistan got off to a poor start when opener Ahmed Shehzad fell for a 12-ball duck, caught off Lahiru Gamage in the fourth over of the innings.
Fakhar Zaman and Azam took the total to 75 before Akila Dananjaya bowled the opener with a googly.
The left-handed Zaman played well during his 45-ball 42 though, hitting four fours and a six.
(This story has not been edited by Business Standard staff and is auto-generated from a syndicated feed.)