The Social Democrats win a slim victory, but face a difficult task to form a coalition in parliament.