Ali scored a 104-ball 102 for his second one-day century to help Pakistan chase down a target of 269 in 47.2 overs at Gaddafi Stadium for a 2-0 lead in the three-match series.
For Zimbabwe Pakistan-born Sikander Raza smashed an 84-ball 100 not out with eight fours and three sixes while Chamu Chibhabha's career-best 99 had 11 fours and a six which lifted the score to 268-7.
Pakistan won the first match by 41 runs in Lahore. The third and final match will also be played at the same venue on Sunday.
The one-day win followed Pakistan's 2-0 win in the preceding Twenty20 matches in the series which marked the return of international cricket in the country after a six-year gap.
International cricket remained suspended in Pakistan since terrorists attacks on the Sri Lankan team bus in Lahore in March 2009.
Massive security remained in place with 4,000 policemen guarding the stadium during all matches.
Police said there was a transformer explosion, some one-and-a-half kilometres away from the stadium, but the match was not affected as Ali led Pakistan's march towards victory.
Ali hit eight boundaries in his 104-ball knock and improved on his best score of 101 -- made against Bangladesh in Dhaka last month -- before falling with 69 needed to win.
Haris Sohail made 49-ball 52 with six fours and Shoaib Malik scored 20-ball 36 with four boundaries and a six to seal the win during their unbroken 60-run fifth wicket stand.
Ali set the victory tone by adding 46 for the first wicket with Sarfraz Ahmed (22), 85 for the third wicket with Asad Shafiq (39) and 56 for the next with Sohail.
Flurry of boundaries
Earlier Raza was in brilliant form as he lifted Zimbabwe with a flurry of boundaries, taking 59 in the last six overs.
This came after Chibhabha became the first Zimbabwean batsman to be dismissed for 99 in a one-day international.
Before Chibhabha three Zimbabwean batsmen -- Malcolm Waller, Alistair Campbell and Andy Flower -- all made 99 in a one-day for Zimbabwe but they all remained not out.
Zimbabwe, forced to make four changes after their regular captain Elton Chigumbura was suspended for two matches over slow over rate in the previous game, were given a solid but slow start of 83 by Chibhabha and Vusi Sibanda (13).
Hamilton Masakadza, leading the team in Chigumbura's absence, fell for 18 dismissed by leg-spinner Yasir Shah who also had Sean Williams (five) to finish with 2-40 in his ten overs.
Chibhabha, whose previous best one-day score of 73 came against the West Indies at Harare in 2007, was shaping well for his hundred but was caught behind off a miscued sweep on the bowling of spinner Malik.
Raza then lifted the tempo with some big hitting, taking 17 off Mohammad Sami's 48th over before reaching his second one-day hundred in the final over. Pakistan's last one-day series win was against Sri Lanka in United Arab Emirates in December 2013.