The world number one and top seed looked in trouble on Court One as the big-serving South African took the first two sets of the fourth-round tie.
But Djokovic fought back to level 6-7 (8-6) 6-7 (8-6) 6-1 6-4 after three hours and four minutes.
Play stopped at 21:03 BST and will resume for the deciding set on Tuesday.
Djokovic, 28, was keen to play on but must return to try to complete his comeback on the same court at 13:00 BST.
The Serb had not dropped a set in any of his first three matches but struggled to live with the power and precision of his 6ft 8in opponent in the opening exchanges.
Anderson's serve is his biggest weapon and he fired down 32 aces against Djokovic, but also backed up those thunderous deliveries with some aggressive groundstrokes.
Djokovic was rattled and unable to find any sort of rhythm, and his double fault at 6-6 in the first-set tie-break allowed Anderson, 29, to fire down an ace to take the set.
Anderson has never reached the quarter-final of a Grand Slam but he moved closer to that goal when he repeated his success in the second-set tie-break, this time taking it thanks to a deft drop shot.
Only then did Djokovic begin to get to grips with Anderson's serve and ambitious approach, and he ran away with the third set.
Anderson continued to attack in the fourth set but a re-energised Djokovic broke him again to maintain his momentum and force the fifth set.
Djokovic and the Court One crowd were eager for that to happen immediately but instead Anderson will have a chance to regroup overnight.
Defending champion Novak Djokovic fought back from two sets down to level his match against Kevin Anderson before bad light stopped play at Wimbledon.