Babar Azam top-scored with 40 as Pakistan defeated Australia by four wickets in the third and final ODI match in Lahore on Thursday to clinch the series 2-1.