Twelve-time major winner Djokovic, just one of two of the world's top 15 playing in the first round this weekend, dropped the first set and was 0-3 down in the second against promising 20-year-old Daniil Medvedev in Nis.
Djokovic, looking to rebuild his confidence after a shock second round exit at the Australian Open, needed first-set treatment on his right shoulder before recovering for a 3-6, 6-4, 6-1 lead.
Medvedev dropped the opening game of the fourth set and then retired with cramps. Earlier, world number 37 Viktor Troicki had given 2010 champions Serbia a winning start, downing 52nd-ranked Karen Khachanov 6-4, 6-7 (3/7), 6-3, 1-6, 7-6 (8/6) in a 4hr 30min marathon.
"The pain I had prevented me from playing the points as I wanted to," said Djokovic. "But it's a good victory and we are in a very good position."
The winners of the tie will face either five-time champions Spain or Croatia in the quarter-finals. Despite missing former US Open champion Marin Cilic, the Croats took the lead in Osijek when world number 223 Franko Skugor stunned 26th-ranked Pablo Carreno Busta 3-6, 6-3, 6-4, 4-6, 7-6 (8/6).
Roberto Bautista Agut steadied the ship for Spain with the world 16 breezing past Ante Pavic -- ranked at 486 -- 6-4, 6-2, 6-3.
Spain are without 14-time major winner Rafael Nadal who skipped the tie after reaching the Australian Open final.
Argentina endured a traumatic start to their title defence when they slumped 2-0 down to Italy despite the fervent support of Diego Maradona.
Playing without Juan Martin del Potro and Federico Delbonis, the stars of their 2016 final victory over Croatia, the South Americans were outclassed at the Parque Sarmiento in Buenos Aires.
A crowd of 2,000, including football icon Maradona, failed to inspire Guido Pella who lost to veteran Paolo Lorenzi, 6-3, 6-3, 6-3. Federer, Nadal, Murray absent.
Andreas Seppi, a late call-up for the ill Fabio Fognini, then made it 2-0 with a 6-1, 6-2, 1-6, 7-6 (8/6) win over Carlos Berlocq who was celebrating his 34th birthday.
"It was a tough match beyond the result as the first two sets lasted almost two hours," said Lorenzi after securing just his second ever singles win in the Davis Cup.
The winners of the tie will face either Germany or Belgium, who are 1-1 in Frankfurt, in the quarter-finals.
World number 22 Alexander Zverev crushed Arthur de Greef, the world 143, to pull Germany level after Steve Darcis downed Philipp Kohlschreiber 6-4, 3-6, 2-6, 7-6 (7/2), 7-5 (7/5).
Nick Kyrgios conceded just seven games in powering Australia to a 2-0 lead over the Czech Republic, who are without Tomas Berdych, in Melbourne.
The controversial world number 15 took just 95 minutes to reel off a 6-2, 6-3, 6-2 win over the 157th-ranked Jan Satral. Rookie Jordan Thompson upset Jiri Vesely 6-3, 6-3, 6-4.
Should 28-time champions Australia seal victory in Saturday's doubles, they could face the United States, winners on a record 32 occasions, if they defeat Switzerland in Birmingham.
The US are favourites after Australian Open champion Roger Federer and Stan Wawrinka opted not to play leaving Henri Laaksonen and 35-year-old Marco Chiudinelli to represent the Swiss.
Jack Sock gave the Americans a flying start with a 6-4, 6-3, 6-1 win over Chiudinelli. In Ottawa, Dan Evans, downed 17-year-old Denis Shapovalov 6-3, 6-3, 6-4 as Britain took a 1-0 lead over Canada.
The 26-year-old, his country's top player after world number one Andy Murray opted out, easily dispatched 234th-ranked Israeli-born left-hander Shapovalov, drafted into the Canadian squad after world number four Milos Raonic pulled out injured.
The winners of the tie are likely to next face nine-time champions France who took a 2-0 stranglehold against Japan who are without world number five Kei Nishikori.
Richard Gasquet swept past Taro Daniel 6-2, 6-3, 6-2 before Gilles Simon overpowered Yoshihito Nishioka 6-3, 6-3, 6-4.