Serbia, the 2010 champions, will face neighbours Croatia for a place in the final.
Djokovic comfortably preserved his 10-year undefeated Davis Cup singles record when he eased past 36th-ranked Alexander Bublik 6-3, 6-4 in 77 minutes to level the quarter-final at 1-1.
The 34-year-old then teamed with Nikola Cacic to see off Andrey Golubev and Aleksandr Nedovyesov 6-2, 2-6, 6-3 in the decisive doubles.
Earlier Wednesday, Mikhail Kukushkin saved four match points to defeat Miomir Kecmanovic to give the Kazakhs the opening point of the quarter-final.
Kukushkin, the world 182, triumphed over 69th-ranked Kecmanovic 7-6 (7/5), 4-6, 7-6 (13/11) after more than three hours on court.
Twenty-time Grand Slam title winner Djokovic has not lost a singles match in the competition since retiring against Juan Martin del Potro in Serbia's 2011 semi-final defeat to Argentina.
His win over Bublik, secured with a break in either set, was his 18th in a row in singles.
Kecmanovic, preferred by Serbia captain Viktor Troicki over higher-ranked Dusan Lajovic and Filip Krajinovic, had been on course for victory after winning seven games in a row on his way to a 3-0 lead in the decider in the day's opening clash.
"You know this kind of match for sure is going to be special in my life," said the 33-year-old Russian-born Kukushkin.
"I don't even know what was the score in the tiebreak. This is why we love the Davis Cup, it's about these kind of matches.
"I'm so honoured to play for my country. Our fans are the best in the world. They gave that kind of support for so many years. I was fighting a lot, it was such a difficult match."
Germany will face either Sweden or Russia in the other semi-final with the final also being played in Madrid on Sunday.