Viktor Troicki clinched it with a comfortable 6-2 6-3 6-4 win over Kazakh number two Aleksandr Nedovyesov in the decisive fifth rubber.
Earlier, Djokovic was kept on court for just short of five hours in completing a vital 6-7 7-6 4-6 6-3 6-2 victory.
Struggling with an eye infection before the tie, an exhausted Djokovic could barely keep on his feet while being interviewed on court and paying tribute to the home supporters.
"You made the difference and gave me the energy to come out on top and I have to thank you for that," he said.
That clinched a 3-1 unassailable lead for the holder Great Britain, who will have to travel to Serbia for July's last eight clash after Wimbledon.
Murray, who won his opening singles and paired with brother Jamie to take the doubles, established a hard-fought two sets to love lead before seeing it disappear as he tired and Nishikori found inspiration.