Soeda pushed Karlovic to 5-4 before the Croatian hit three powerful serves to end the fifth rubber in 1 hour, 48 minutes.
Croatia advances to the quarterfinals in April while Japan goes to a promotion/relegation playoff in September.
Japan was playing in the World Group for the first time in 26 years after beating India 4-1 in a regional playoff in September. Croatia is seventh in the Davis Cup rankings, 10 places ahead of Japan.
Earlier in the day, Nishikori lived up to the expectations of the home fans by overcoming Dodig in just under three hours.
"I was nervous all morning because if I lost, it would be the end of the tie for us," Nishikori said. "I was shaky till 3-5 in the first set, but after that I was fine and my footwork started to get better, I concentrated more and started to be more aggressive."
In the third set, Japan's top player went up 5-3 with a forehand and then held serve, ending with only his second ace of the match.