It was obviously justified tactically, strategically, and morally.
This was total war and the enemy leadership was utterly unwilling to think of surrender before they received a game-changing wake-up call.
Which was delivered at the coast of a mere ~250K enemy killed. Vastly fewer than would have died in the follow-on invasion of the Japanese home islands. And with zero, repeat zero, American casualties. Versus the over 1M estimated for the planned invasion.
This is probably the cleanest example of a morally justified attack in wartime since the Roman days.