Hirohito's broadcast surrender on Aug. 15th, and what exactly caused it, seems to be quite open to debate.
Why not both?
But seriously — it's hard to say, in part because the events are so coincident in time.
It is clear that on August 9th, the Japanese cabinet made its decision to terminate the war and to mostly accept the terms put forward at Potsdam. (I say "mostly" because their surrender agreement included conditions, and there was sort of a back-and-forth dance with the US for several days as the US rejected these conditions.)
It is also clear that the entry of the Soviet Union into the war had a profound effect on both the militarists (whose end-game plans did not include the Soviets) and those seeking a diplomatic solution (whose end-game plans required a neutral Soviet Union as an arbiter).
It is clear that the bombing of Hiroshima did not change the essential stance of the cabinet though it did rattle some members of it. (The bombing did cause Stalin to move his invasion plans up a bit.) News of the Nagasaki bombing reached the cabinet as they were discussing things in light of the Soviet invasion.
Can we really disentangle such things? I've read the strongest book in favor of saying "it was definitely the Soviets" (this is Hasegawa's Racing the Enemy) and found the argument a little thin on that point. I think there can be no doubt that the Soviet invasion had a profound effect on the Japanese high command — Hasegawa is very convincing on this point. But can more be said about it than that?
Implicit in this kind of argument are a set of counterfactuals, i.e., "Would Japan have surrendered if the atomic bombs had not been used, but the Soviets had still entered the war on schedule?" These are super hard to answer in a convincing way. Hasegawa does pose these questions and ultimately concludes that the bombs weren't necessary, and that even the Soviet invasion wasn't necessary — that is, he thinks it probable that Japan would have surrendered prior to the US invasion scheduled for November, in part because they were running out of food. I find these kinds of questions interesting but I don't see any rigorous way to answer them. I prefer a "they both had an effect, but that isn't implying that either could have been removed from history and have the same outcome" sort of answer, which is boring but fairly safe.
I would personally argue that the bombs had minimal effect on that decision. The fact is that there was such efficacy in traditional bombing tactics that death tolls much higher than those in Hiroshima and Nagasaki were already occurring.
I believe the decision stemmed from two factors. 1, the U.S. taking of adjacent islands, thus eliminating the foreign buffer zone, and 2, a LOT of angry Russian troops on the border. It is worth remembering the bloody wars between the two in the early 1900s.