These days it's relatively easy to detect nuclear weapons blasts. This is because we know about the existence of atomic weapons, seismometers all over the world can now detect gigantic explosions of that size.
But I have to imagine that in 1945, before the age of instant news, it would have been a lot harder to figure out what had happened. Given the near-state of cold war that existed by the end of WW2, I doubt the US was too keen to divulge the existence of our new superweapon to Stalin beforehand, so I'm curious to know how does a major superpower of that era find out about it?
A Soviet physicist, one Georgii Flerov, wrote to Stalin in April 1942 telling him that it must be the case that the USA was building an atomic bomb, since every physicist active in nuclear research had simply disappeared. This led eventually to a massive Soviet espionage attempt against the United States' Manhattan Project, dubbed ENORMOZ for the size of the US effort. The most important spies were several physicists and engineers who worked on the project and volunteered their services to the USSR. As a result, the Soviets, and Stalin personally, were well aware of the US atomic bomb effort prior to Hiroshima.
Truman himself hinted at the fact of the bomb when meeting with Stalin in July 1945, which only told Stalin that 1. Truman was not to be trusted, and 2. the planned US nuclear test (Trinity) had probably been successful. Immediately afterwards Stalin went to Vyacheslav Molotov, his foreign minister, and told him that they needed to accelerate their work on a bomb of their own.
As for Hiroshima, the fact of the bombing was not a secret after it happened, and in fact Truman's famous press release (which Truman of course did not write) was quickly circulated widely. The Manhattan Project had already established an impressive Public Relations Organization to make sure that it was flooding the world's airwaves with its own version of the story. This was still a world of radio, telephone, and telegraph; news could be sent and received quickly. (General Groves could even have real-time teletype conference with Col. Curtis LeMay to talk about the Hiroshima results.)
Stalin learned of the event on August 7th, the day after Hiroshima.* He was at his dacha. His "usual visitors" (probably Molotov, among others) came to see him and told him about the bomb. His immediate response, according to his daughter Svetlana, was to sullenly withdraw to his chambers and actually get ill. His second response was to sign an order for the Red Army to attack Japanese forces in Manchuria by August 9th.
The Soviets had been planning to enter the Pacific War in mid-August 1945; Stalin now worried the war might end too soon for that, and worried that Truman had dropped it explicitly to cut him out of the Pacific front. (This was likely Truman's intention, incidentally — this is why he wanted the bombs dropped on the first good-weather day after Potsdam ended, on August 3rd.) The Soviet units in the East managed to get things together to declare war and pour over the Manchurian border on midnight of August 8/9. (The Nagasaki bombing happened a few hours later.)
Stalin also raised the Soviet bomb project to top priority — he saw the atomic bomb as something that had "unbalanced" the world, and he made it clear to his scientists and spymasters that the USSR would not be caught off-guard again.
Molotov met with the US Ambassador on August 7th and told him, "You Americans can keep a secret when you want to." The Ambassador noted "something like a smirk" on his face. We now know what that extra meaning that smirk carried.
Further details are in Holloway's Stalin and the Bomb and Gordin's Red Cloud at Dawn. On the timing/invasion issues, see Hasegawa's Racing the Enemy.
* A note: time zones make all of this a little jangled up. General Groves in Washington, DC, found out that Hiroshima was successful at 11:30pm EST on August 5th, which is 6am August 6th on Moscow time. The press releases were released on the morning (I don't have the exact time in front of me) of August 6th, EST time, which is late in the afternoon Moscow time. So give it a few hours to fully circulate and what you have is Stalin being told as soon as possible in the morning after the news would have been received assuming he turned in early the night before.
How was he informed of the Hiroshima bombing itself I have no information on, however Stalin was told by Truman at an interlude during the Potsdam Conference of a new weapon but was pretty vague about it;
On July 24 I casually mentioned to Stalin that we had a new weapon of unusual destructive force. The Russian Premier showed no special interest. All he said was he was glad to hear it and hoped we would make "good use of it against the Japanese." Harry S. Truman, Year of Decisions