Two were: one on Hiroshima, one on Nagasaki.
So no, I don't think just detonating the bombs "harmlessly" would have have had the same effect. In fact hitting a target just slightly off the mark(like Tokyo Bay) would have been presented as American incompetence and failure of aiming.
I think what got Japan to surrender was a certain common sense in the emperor and some of the elite that a final last stand wouldn't do them much good. Especially not with the Soviets joining in.