NEW YORK — It was the buy signal that markets were waiting for.
When European Central Bank president Mario Draghi vowed to ‘‘do whatever it takes’’ to keep the continent’s monetary union intact, stocks were off to races in the US and Europe.
The Dow Jones industrial average on Thursday jumped 212 points, or 1.7 percent, to 12,888 following big gains in European markets. Benchmark stock indexes in Spain and Italy surged 6 percent and 4 percent in France.
Draghi’s comments at an investor conference at the Olympics raised hopes that Europe’s central bank might intervene to bring down the cripplingly high borrowing costs for struggling European countries like Spain and Italy.
After insisting for months that it was up to European governments to restore confidence in the currency shared by 17 nations there, Draghi pledged that ‘‘the ECB is ready to do whatever it takes to preserve the euro.’’
That commitment gave a big boost to global markets.
‘‘The No. 1 problem in the world now is Europe’s finances,’’ John Fox, director of research at Fenimore Asset Management, said. ‘‘When the head of the ECB comes out and says he’s willing to do anything, that’s code for ‘We are going to agree to resolve this issue.’”
In other signs that investors were becoming more confident that Europe’s financial crisis would not spin out of control, borrowing costs for Spain and Italy fell sharply, the euro surged a penny to $1.23 against the dollar and the yield on the 10-year Treasury note rose to 1.43 percent from 1.40 percent late Wednesday. Investors tend to sell low-risk assets like Treasurys when they’re less fearful about global markets and the economy.
As earnings reports this week from Caterpillar and Ford have shown, Europe’s troubles can have a big impact on the results of major US corporations.
‘‘Close to 20 percent of the S&P 500 companies’ revenues comes from Europe,’’ said Lawrence Creatura, portfolio manager at Federated Investors. ‘‘We’re in a global, interconnected economy and Europe’s troubles are our own today.’’
The broader the Standard & Poor’s 500 index rose for the first time in five days. It was up 22.13 points, or 1.7 percent, to 1,360.02.
The gains in the US stock market were broad. All 10 of the industry groups in the S&P 500 index rose, led by telecommunications companies.
In other trading, and the Nasdaq composite index rose 39.01 points, or 1.4 percent, to 2,893.25, despite more disappointing news from technology companies including the online game maker Zynga.
Several US companies were also rising sharply after reporting stronger earnings. Sprint Nextel jumped 68 cents, or 20 percent, to $4.05. The country’s third-largest wireless carrier was successful in convincing smartphone subscribers to pay up for ‘‘unlimited data’’ service, and its service revenue zoomed higher, beating analysts’ estimates.
In Europe, Draghi’s comments came after days of uncertainty in Europe and rising concern over Spain’s recession and the country’s banks, which are reeling following the implosion of a real estate bubble. As borrowing costs for both Spain and Italy rose in the past week, investors feared that both countries might need to be rescued, like Greece, Portugal and Ireland had been in the last two years.
Borrowing costs for Spain’s government plunged following Draghi’s comments as investors anticipated that the European Central Bank might step up its purchases of Spanish government bonds.
The yield on Spain’s benchmark 10-year bond dropped almost half a percentage point, a huge move, to 6.89 percent. That rate surged as high as 7.54 percent this week as investors dumped the country’s bonds and lost confidence in Spain’s ability to manage its debts.
Technology companies continued to report disappointing earnings following industry leader Apple’s rare earnings disappointment earlier this week.
Zynga, which produces popular social network games ‘‘CityVille’’ and ‘‘FarmVille’’ posted poor quarterly results and cut its outlook, prompting a number of analyst downgrades. Its stock fell $1.90, or 37.5 percent, to $3.17.
Zynga’s disastrous results were also a bad omen for Facebook, which got about 12 percent of its 2011 revenue from Zynga. Facebook plunged 10 percent in after-hours trading after the company reported a loss of $157 million for its second quarter. The stock was down $2.63 at $24.19.
Among other stocks making big moves:— PulteGroup jumped $1.84, or 18 percent, to $11.86 after the homebuilder posted a quarterly profit, beating Wall Street’s forecasts thanks to higher house prices and sales.
— United Continental slumped $1.21, or 6 percent, $19.20 after the combined airline’s second-quarter net income dropped 37 percent as it continued to wrestle with merger-related issues.
— Whole Foods Market jumped $9.57, or 11 percent, to $94.10 after the natural and organic foods store chain lifted its profit outlook for the year. Its net income jumped 32 percent in the latest quarter as shoppers spent more.