Oh, that is true for sure. Howvere a large part of the reason was to end the war in the East as soon as possible.
It also gave America a change to wave a big stick at Russia, who joined in at the very end of the war in order to claim/reclaim (dependingon your pont of view) some of the northely Japanese islands.
But a swift end to the war, and the avoiding of another Okinawa (where more people died than in Hiroshima remember), was central to the decisison.
There has been some discussion as to why they didn't take Japanese observeres and detonate another bomb to show them what it would do. This was discounted as the Americans were not 100% that the bomb would detonate (at the time of the first trial detonation at los alamos Enrico Fermi was still a little unsure if the bomb would cause a chain reaction that would cause all of the Earths atmosphere to combust, this was a very new area they were working in, with lots of uncertenties), they were not sure that the Jpanise observers would be listened to by the Milatary who were effectivly running the country with the puppet emperor, and they also probably 'wanted' to see it in action.
Large numbers of the scientists who had been part of the Manhatten project had petioned the President to do just this sort of thing, but they were refused.