This being an ethics question, you could say there is no right answer. Many people will say never - because, say, it can never be right to deliberately kill innocent non-combatants. That doesn't show that it's wrong to have a policy of threatening to use those weapons, as half a dozen or so countries currently do. (Such a policy may be wrong also - but the two claims are distinct.)
Also, though it's easy to say "attacking another country with nuclear weapons could never be justified," there may be hard cases. What if you have the weapons as a threat (because you think you're defenseless against The Bad Guys otherwise), and then during some crisis TBG use ONE such weapon against you. Suppose you then think that the only options are (a) surrender to TBG, (b) an all out strike to destroy TBG, or (c) a like-for-like strike to make TBG back down. You MIGHT think (c) is the least-bad option in the long run. So that could be your answer.
You could invent another case easily by basing it on the only real one: in 1945, some advisers to President Truman argued that using nuclear weapons against Japan would force a surrender and therefore save lives (or: "save American lives")* in the long run.
*Note that those two last claims are ethically very different - and at the time the argument was deeply tinged by racism.
But even if it was clearly true that fewer people overall would die from the weapons than from a subsequent invasion of Japan ("So you'd be saving Japanese lives too, Mr. President ..."), one should ask whether the killing of helpless innocents for that end was justifiable. Interestingly, the Allied powers in 1939-40 virtually defined Nazi barbarism in terms of their attitude to civilian casualties ... but by 1944-45 were doing exactly what they had condemned the Nazis for doing. In short - some people would cite Hiroshima / Nagasaki as the example you want - and some people are appalled by that. (In his Among the Dead Cities, the philosophy AC Grayling argues that all the Allied leaders would have been hanged for war crimes if they had been tried according to the very principles they set out in order to try the surviving Nazi leaders at Nuremberg.)
Hope that helps,