Earlier, Australia were provided with a flying start by David Warner as he smashed his way to 35 from 23 balls before giving a tame chance to cover to hand Ngidi his first wicket of the day.
Steve Smith and captain Aaron Finch then kept control of things for some time. However, it was Ngidi once again who struck again to remove Smith and Marnus Labuschange with consecutive deliveries and picked up his 50th ODI wicket.
D’Arcy Short, who came in next, then shared a 77-run stand with Finch before Anrich Nortje got the priced scalp of the Australian skipper at 69.
The visitors suffered from a late collapse as they lost their last six wickets for 47 runs in the final 51 balls to be bowled out for 271.
Ngidi finished with figures of 6/58 and in the process also became the fastest South African to the reach the 50 ODI wicket-mark, edging out Lonwabo Tsotsobe by one match.
The Proteas did not have a great start to their chase as they lost their captain Quinton de Kock in the very first over. However, J.J. Smuts and Malan then came to the rescue for the hosts and steadied the ship and put on 91 runs before the stand was broken by Adam Zampa.
Kyle Verreyne, who had a great debut in the first game, failed to come up with a good show this time around and managed just three before departing and bringing Heinrich Klaasen to the middle. Klaasen played the aggressor to Malan’s steady innings, and reached a run-a-ball fifty before Zampa sent him back to the dressing room at his individual score of 51.
David Miller and Malan then shared an unbeaten 90-run partnership for the fifth wicket as the hosts crossed the line without any hiccups.
South Africa had won the first match in Paarl by 74 runs. The two teams will now face each other in the dead rubber on Saturday in Potchefstroom.
Brief Scores: Australia 271 all out (Aaron Finch 69, D’Arcy Short 69*; Lungi Ngidi 6/58); South Africa 274/4 (Janneman Malan 129*, Heinrich Klaasen 51; Adam Zampa 2/48)