Officials and players during a cake-cutting ceremony to celebrate Dubai International Cricket Stadium's 10 years.
Needing 278 to win, Pakistan were brought close to their target by Ali's 112 and Rizwan's 104 but in the end the twin hundreds were in vain as they failed to score a required 17 off Marcus Stoinis's last over.
The win gives Australia a 4-0 lead with the last match also in Dubai on Sunday.
Glenn Maxwell missed a second career hundred by just two runs, Usman Khawaja scored 62 and Alex Carey 55 as Australia posted 277-7 in their 50 overs.
Ali and Rizwan had put Pakistan on course for victory with a 144-run third-wicket stand but once Ali departed off leg-spinner Adam Zampa in the 42nd over, the innings wilted under the pressure of 60 runs in the last 8.5 overs.
Umar Akmal and debutant Saad Ali fell for seven each to paceman Nathan Coulter-Nile who finished with 3-53 while Stoinis had Rizwan and Usman Shinwari (six) in the final over to seal the win.
Ali, only drafted into the side two hours before the start after Imam-ul-Haq went down with fever, grabbed his opportunity, completing his hundred off 111 balls.
He was lucky to survive a leg-before appeal on 98 off Zampa as the review went on umpire's call. He took two singles to reach the three-figures mark.
Ali is the 15th batsman to score a hundred on one-day international debut. Salim Elahi (102 not out v Sri Lanka at Gujranwala in 1995) and Imam (100 v Sri Lanka in Abu Dhabi 2017) were the other two Pakistani batsmen to score debut ODI tons.
Ali hit nine boundaries in his 111-ball knock while Rizwan had a six and nine boundaries off 102 balls.
Earlier, it was Maxwell who lifted Australia - sent into bat - from 140-5 to an imposing total. Maxwell hit three sixes and nine boundaries in his 98 off 82 balls.
A new look Pakistan team, with Imad Wasim as skipper after Shoaib Malik was ruled out with a rib injury, caught Australia napping at 101-4 when Maxwell walked in.
Dropped on 10 by keeper Rizwan off Yasir Shah, Maxwell repaired the innings with a 134-run partnership for the sixth wicket with Carey who finished with 67-ball 55 for his maiden fifty with three boundaries.
Maxwell, bowled by fast bowler Usman Shinwari off a no-ball when on 76, was within a sight of his second ODI hundred when he was run out while attempting a double run.
Carey supported Maxwell as the pair beat the previous sixth wicket stand in Australia-Pakistan ODIs of 90 between Dirk Wellham and Rod Marsh at Sydney in 1981.
Australia lost in-form opener Aaron Finch for 39, one short of completing 4,000 one-day runs while Usman Khawaja made a solid 78-ball 62 with six boundaries before he was trapped leg-before by Yasir who finished with 2-57.
Wasim, who had figures of 2-56, dismissed Shaun Marsh (five) and Peter Handscomb (seven) while Mohammad Hasnain got the prized wicket of Finch before dismissing Carey off the last ball, grabbing 2-52.Unstoppable
Australia
A. Finch lbw b Hasnain 39
Usman Khawaja lbw b Yasir 62
S. Marsh st Rizwan b Wasim 5
P. Handscomb c Sohail b Wasim 7
M. Stoinis b Yasir 2
G. Maxwell run out 98
A. Carey c Sohail b Hasnain 55
N. Coulter-Nile not out 2
Extras: (b2, lb1, nb1, w3) 7
Total: (for 7 wkts; 50 overs) 277
Fall: 1-56, 2-65, 3-98, 4-101, 5-140, 6-274, 7-277
Bowling: Shinwari 10-0-53-0 (1nb), Junaid 10-1-47-0 (1w), Hasnain 9-0-52-2 (1w), Wasim 9-0-56-2(1w), Yasir 10-0-57-2, Sohail 2-0-9-0
Pakistan
S Masood b Coulter-Nile 0
A Ali c Finch b Zampa 112
H Sohail c Maxwell b Lyon 25
M Rizwan c Handscomb b Stoinis 104
U Akmal b Coulter-Nile 7
S Ali c Richardson b Coulter-Nile 7
I Wasim c Marsh b Richardson 1
Y Shah not out 3
U Shinwari c Handscomb b Stoinis 6
J Khan not out 0
Extras: (lb3, w3) 6
Total: (for 8 wkts; 50 overs) 271
Fall: 1-0, 2-74, 3-218, 4-229, 5-253, 6-257, 7-263, 8-270
Bowling: Coulter-Nile 10-1-53-3, Richardson 7-0-37-1 (1w), Stoinis 3-0-20-2 (2w), Lyon 10-0-49-1, Zampa 10-0-49-1, Finch 2-0-19-0, Maxwell 8-0-41-0
Result: Australia won by six runs
Toss: Pakistan
Umpires: Kumar Dharmasena (SRI) and Rashid Riaz (PAK)
Tv umpire: Michael Gough (ENG)
Match referee: Jeff Crowe (NZL)