Espionage by itself does not get you an atomic bomb. It might get you some useful facts and information (which you then either have to trust blindly, or undergo a lot of work to verify), some basic ideas about what the spied-upon country did (not perfect blueprints, not perfect anything), and maybe — if you're lucky — a few useful samples of technology or materials.
To turn that into an actual bomb, you then need the scientific and industrial infrastructure that will let you gain completely mastery over the science and technology involved, plus the means to actually manufacture fissile material (bomb fuel, through uranium enrichment and/or nuclear reactors), plus the means to manufacture all of the switches, high-explosives, and so on that make the bomb a real thing.
I only emphasize this because your either/or question is wrong; with or without espionage, the bulk of work would necessarily have to be driven by engineers and scientists within the Soviet Union. The question is how the espionage could be used, and was actually used, and what its relationship was to the rest of the effort. But espionage can't get you a bomb — not by itself. It takes so much more.
In the case of the Soviets, their atomic bomb project was run by Lavrenty Beria, who was also their spymaster (NKVD). He was not the trusting sort (for good reasons). He took every piece of Allied intelligence with a grain of salt, and kept his own scientists (save one or two at the "top") from even knowing it existed. He allowed the espionage information to be sanitized and introduced into their existing work as "data from another Soviet laboratory," and used it as a "check" on the work of his scientists (which he also did not trust). Ultimately the Soviets did use the model of the Manhattan Project (both espionage information and published information) as the basis of their own bomb project, which makes sense, given that they knew it had worked and produced results in a short amount of time. They also used information gained on the first atomic bomb tested as the model for their own first bomb, even though their scientists had come up with more sophisticated models by that point, because Beria wanted the first test to be an unquestioned success (because his boss was Joseph Stalin, also not the trusting sort). So in that sense, the espionage did aid and guide the Soviet project. However the Soviets also re-checked every aspect of it, re-did the experiments that created the data they got, and innovated beyond it. And in some places, they even found things the Americans did not find — the Soviets innovated in the area of centrifugal enrichment, for example, which the Americans had not been able to make work.
The one "caveat" to the above is that the Soviet project was not made exclusively of Soviet citizens. They did acquire some German and Austrian scientists as part of their raiding of the Third Reich's technical infrastructure. They largely kept these segregated from their Soviet scientists, but they did make some significant contributions. (It was a group of Austrians and Germans that developed the centrifuges, for example.) After Stalin died, many of these foreign workers were allowed to leave the USSR and return to either West or East Germany.
There is not much evidence that nuclear espionage made a large contribution to the Soviet weapons developments after the 1940s; almost all of their successful technical espionage (that we know about) dates from the World War II and immediate postwar period. It is also clear that the Soviets had many very talented scientists and engineers who were very willing to apply their talents to the cause of Soviet weaponry, no doubt fearing what would happen to their country in a war with the United States if they did not.
So as you can see, the question is not quite as black and white as you ask it. The Soviets did use espionage, but they also required an immense domestic scientific and technological effort to pull it off. It is not possible to say what would have happened if they didn't have the espionage, but there is every reason to think they would have accomplished a nuclear weapon in around the same amount of time. The timetable of their project was not set by information, but acquisition of the raw resources you need to make bomb fuel.
Further reading: Gordin's Red Cloud at Dawn is precisely about the relationship between the American and Soviet bomb projects, and is a good read.
Operations Alsos and Osoaviakhim were the USSR's counterparts to the better-known Allies' Operation Paperclip. The goal of all of them was to acquire German technical and scientific intelligence, material and personell. You might know that head of the V2 programme Verner von Braun was extracted to the US, where he more-or-less conducted the space programme for the US. The first space missions were launched on basically V2 missiles.
Anyway, yes. Operation Alsos was atomic-energy focussed, and the USSR acquired material and atomic scientists from Germany in 1945-46.
The USSR also cultivated a number of spies within the Manhattan Project and later western atomic energy projects. The German-born Klaus Fuchs was a high-ranking scientist with the Manhattan Project and passed high-level material to the USSR.
The UK was second to detonate a nuclear bomb in 1952, shortly followed by the USSR in 1953. The UK had their own nuclear research programme during WWII, colourfully code-named 'Tube Alloy Research' - the idea being it was so boring-sounding no-one would ask questions.
Moving into the Cold War, the USSR need not rely on espionage to develop their nuclear programme. There was strong scientific and technical education in the Soviet Union. No doubt they got a leg-up from Operation Alsos (as did the Allies from Operation Paperclip), but by the 1950s and onwards, the USSR definitely had the scientific ability and technical nouse to develop their programme independently.