As pohnpei remarks, Stalin had a personal goal to gain as much power as he could for himself at the apex of society in the Soviet Union, and to maintain that power. He was ruthless in dealing with enemies, real and imagined, leading to the creation of a society where people were afraid to challenge him. He was liable even to turn on those that might appear closest to him in the centre of power in the Communist Party. His motivation for this undoubtedly sprang from his personal ruthless temperament - a temperament that had been further hardened during the days of absolute turmoil, hardship and civil war that surrounded the Communist Revolution in Russia in 1917.
However, this remorseless concern with absolute power (while attempting to maintain something of the facade of an open, free society) also came from the fact that, having achieved control in such turbulent circumstances, Stalin was determined that the Communist Party should retain the leadership of the country at all costs. In addition, Stalin and other tough, ruthless men at the top of Party hierarchy felt it was imperative to maintain absolute control during the drive to modernize the Soviet Union. Russia had long been a technologically backward country but Stalin's broader goal was to make his country an advanced, modern society capable of challenging Western powers, as pohnpei observed. To achieve modernization in a relatively short time was an enormous task, and Stalin evidently felt that it could only be achieved in a ruthless manner. Witness, for example, his treatment of the more wealthy peasants (kulaks) who did not want to be part of his vast collectivization schemes, and were brutally coerced.
Stalin, then, had the personal goal of achieving and keeping power for himself, and the broader aim of modernizing his country as fast as possible. In this last aim, he was certainly motivated by the urgency of keeping pace with the Western powers in an uncertain time of economic crises and world wars. However, contrary to what pohnpei suggests, he did not necessarily envision the spreading of Communism across the globe. This was certainly what the likes of Lenin and Trotsky had wanted earlier, but Stalin came to see that it was not a realistic aim and settled on the principle of 'Socialism in One Country'. If the Soviet Union was going to be isolated as a Communist country, he would make sure it was strong enough to take its place as a world power and defend itself against other nations.
Joseph Stalin had two major goals, one personal and one related to his country and ideology.
On the national/ideological level goal, Stalin wanted to create a Soviet Union that was strong enough to challenge the West. His motivation was that he wanted a country that would be able to help spread communism across the world. This country would, ideally, be both an economic and a military power.
On the personal level goal, Stalin wanted power. He wanted to be the one person in control of the Soviet Union. This can be seen very clearly in the bloody purges that he ordered. The main goal of these purges camefrom his motivation to ensure that no one in the Soviet Union would have any chance of taking power away from Stalin.