The title says it all. From what I understand the Soviets were the only ones who were willing to help Republican Spain, although not for free. On the other hand sending most of their gold away kind of wrecked the economy (as if the civil war wasn't enough).
So I want to know, was it the right choice to pay for Soviet aid with the gold reserves?
It is, I think, uncontroversial that Soviet aid was vital to the Republican war effort. While the economic ramifications are debatable - I'll touch on this below - the fact remains that without this aid, the Republican position would have quickly become untenable. This was not a war being fought based on Spain's own resources. If it had been, the Republic would have had a significant advantage, as it controlled most of Spain's industry for most of the conflict. However, with the Francoist side seeing significant, regular and ongoing aid from Germany and Italy in particular (as well as direct armed intervention), the advantage that Spain's limited industrial base gave the Republican side was minimal. Without importing weapons, munitions and other supplies, there was no hope of continuing the war through 1937. As it was, the Republican armed forces were being run on a shoestring, using a vast array of modern and semi-obsolete weapons sourced from any arms dealer shady enough to do business with them, requiring a daunting range of different munitions, adding to the logistical burden. This was not by choice, but reflected the sheer difficulty they had in sourcing supplies overseas, and highlighting the corresponding importance of their one (semi-)reliable source of weapons.
Here's where the historical debate gets tricky: if the Republic spent so much overseas, particularly in the USSR, why did they get so little in return? This is one of the enduring controversies of the civil war, and more particularly its international context - namely, whether Soviet intervention was motivated by anti-fascist altruism, or was a cynical ploy to cheat Spain out of its gold reserves by overcharging for weapons and other aid. The current historical consensus, I think, is somewhere in the middle - that the USSR was motivated to intervene for ideological and strategic reasons, but the aid provided was on a relatively straightforward commercial basis.
In any case, on the eve of war in 1936, Spain was home to about $700,000,000 worth of gold (in 1936 prices), excluding the artistic or historic value of individual pieces or coins, held at the Bank of Spain in Madrid. In maintaining control over Madrid on the outbreak of the civil war in mid-July 1936, the Republican government therefore maintained control over Spain's gold reserves. They remained in Madrid until September 1936, when the decision was made to move the gold to Cartagena as Madrid's position grew more precarious in the face of Nationalist advances (and, apparently, rumours that anarchist factions were considering raiding the bank). Cartagena, far from the front and the main base of the Republican Navy, was considered the safest place for it.
Even before its transfer, Spain's gold reserves were being used to fund the Republican war effort. Literally within days of the military uprising (authorisation came on July 24th), gold was dispatched from Madrid to Paris to buy French weapons. When shortly afterwards on August 8th, France decided to adhere to the new Non-Intervention Agreement proposed by the British, and therefore cease arms sale to both sides, gold continued to flow to Paris in order to buy hard currency with which to purchase arms elsewhere. These transfers continued until March 1937, by which stage just over a quarter (26.5%) of Spanish gold reserves were now held by the Bank of France.
The controversial part was what happened to the rest of the gold. The Soviet Union had decided to support the Republic directly in September 1936, chiefly as a response to continued intervention by Fascist Italy and Nazi Germany. Most of the remaining gold - about 4/5ths of the amount shipped to Cartagena, which excluded some of the amount already transferred to France - was shipped to the Soviet Union in late October. The total value of this shipment was just over $500 million at the time, though this excluded, as noted above, any artistic/numismatic value, which is one source of the aforementioned controversy. Calculating the value of the arms provided (some estimates conclude that the Republic was routinely overcharged by about a quarter for weapons), plus shipping and other legitimate expenses incurred by the USSR, is also difficult, and continues to fuel the debate about whether the Spanish Republic was cheated.
This gold was used in several ways. Part of it was used to pay the substantial (c. $50 million) debt already incurred in purchasing Soviet arms. Over the course of 1937, about half of it was liquidated for hard currency to purchase arms elsewhere, and another $131 million was used to pay for further Soviet arms shipments. Eventually, however, the gold ran out, and the Soviet Union agreed to grant an initial $70 million line of credit to purchase more arms (which was quite a negotiating coup for the Republicans, who expected to get much less) in February 1938. This, in turn, was extended further in late 1938, though there is less clarity as to by how much. This - combined with the willingness of the Soviet Union to send arms before receiving any gold shipments in September-October 1936 - is taken as evidence that Stalin's motives were not entirely mercenary, though there is little doubt that the first arms shipments were made in the expectation that the gold would soon be forthcoming. Given that the loans would never be repaid after the defeat of the Republic in early 1939, it is difficult to conclude that the USSR profited hugely from the conflict. Moreover, scholars such as Daniel Kowalsky have pointed out the Soviet aid was constrained by more than just payment - the USSR was not a naval power, and had a great deal of difficulty securing supply lines to Spain in the face of a legal international blockade (as required by the Non-Intervention Agreement, which was what prevented Republican Spain from their first choice of international markets in France) as well as illegal efforts by the Italian Navy in particular to sink shipping heading to Republican ports. It's not clear how much more the USSR could have actually done to support the Republic even had it wanted to.
It is still a reasonable question as to whether the economic impact of this decision ended up crippling Republican Spain anyway. Michael Seidman certainly makes the case that it was the inability to manage the home front effectively in the face of inflation and chronic shortages that doomed the Republic's war effort. To my mind, I'm less convinced that this was the result of the loss of gold reserves, such much as the result of the Francoist side having secure lines of supply from abroad (on credit), particularly through Portugal, as well as initial control over fewer cities but more agricultural land, resulting in an easier time feeding its population. Inflation in the Republican Zone, in this view, was more about chronic shortages exacerbated by the diplomatic context than its dwindling gold reserves.