After Australia won the toss, South Africa piled up 80 for one and looked to be on course for victory when the touring side required 15 from six balls to win.
That was reduced to 13 from four but 39-year-old Hodge crashed two sixes to the mid-wicket boundary off Wayne Parnell to guide his side to 81 for five with two balls to spare as he ended on 21 not out from eight deliveries.
South Africa made just six in their first two overs but a sparkling unbeaten partnership of 74 off 32 balls between Quinton de Kock (41 not out) and Faf du Plessis (27 not out) lifted the home side to 80 for one.
De Kock was the main aggressor and his runs came off only 20 balls including four massive sixes and two fours.
David Warner's golden summer in South Africa continued when he smashed 40 from 16 balls and Australia looked like cantering to their target.
But two wickets in the fifth over from JP Duminy, including Warner's, put the brakes on the tourists and the game briefly swung in the home side's favour.
They could not tie down Hodge in the final over, however, and the teams head into Friday's final match in the series with Australia leading 1-0 after the first game in Port Elizabeth was washed out without a ball being bowled.
- Sports & Recreation
- South Africa
- Wayne Parnell