Serbia beat Croatia to reach their first Davis Cup semifinal, as Novak Djokovic brought the deciding point with win over Marin Cilic.