It was the market rally that defied gravity and left many with a case of vertigo.

Despite turbulence in Washington, China and Europe, which threatened at several points to pull the world into another recession, stock prices just kept rising in 2013.

The benchmark Standard & Poor’s 500-stock index led the way, ending the year almost 30 percent higher than it began, or 32.4 percent higher with dividends counted in. That’s the biggest jump since 1997, when the technology bubble was inflating. Even the returns from the heady years of the real estate boom were left in the dust.

Related Links Returns for the S.&P. 500 Are Best in 16 Years

As 2013 drew to a close and evidence of a strengthening economic recovery mounted, Wall Street was feeling giddy. But the feeling was tinged with a sense of anxiety that the ascent might have been fed by a bit too much hot air.

“It’s really great, but you just don’t feel entirely comfortable with it,” said Dan Morris, the global chief investment strategist at the asset manager TIAA-CREF.

Most analysts delivered their forecasts for 2014 with a good dose of caution, warning that corporate profit would have to catch up with stock prices before further gains were warranted.

In other popular corners of the financial markets, investors were left nursing their wounds after previously reliable assets turned negative. Goldbugs were routed as the price of gold plummeted 28 percent. The drop came after years in which pessimistic investors stockpiled gold as a hedge against bad times. Gold finished on Tuesday at $1,202.30 an ounce.

More investors felt the sting of a decline in the bond market after decades in which bonds were trumpeted as the safest place for retirement money. The prices of bonds fell as the yield on the benchmark 10-year Treasury nearly doubled during the year, ending on Tuesday at 3.03 percent. A Bank of America index of the total returns on United States government bonds fell 3.2 percent for the year, the first annual decline since 2009. Few are predicting much of a turnaround any time soon, given the likelihood of a continuing rise in interest rates.

All of the big moves of 2013 were much greater than most financial analysts expected at the start of the year. Coming out of 2012, a cloud of anxiety, similar to the current one, hovered over Wall Street. That was caused, in no small part, by the fractious debate over the so-called fiscal cliff, which was resolved only on the last day of 2012. The average prediction of strategists at the big banks was that the S.&P. 500 would rise a modest 7.3 percent in 2013, according to a tally done by Bloomberg.

Those projections were quickly upended when the year began with a rally that ran almost unbroken for months.

But then a series of crises threatened to derail the optimism. When the Greek government fell apart at the beginning of the summer, there were fears that the European common currency might splinter with it.

About the same time, Federal Reserve officials began dropping hints that they might be ready to start pulling back on a bond-buying program that had helped buttress the economy since the financial crisis. That led to a market downturn in the United States and even worse damage in developing countries that had used the Fed’s easy money policies to take out cheap loans.

When those flare-ups faded, Republican congressional leaders resisted raising the government’s borrowing limit, threatening to push the country into default for the first time.

“It was surprising to me this year with all the political dysfunction in Washington that we didn’t see more of a pullback,” said Marshall B. Front, the chairman of Front Barnett Associates. “I’ve been calling for a correction for two years and I still haven’t seen one.”

As each crisis was resolved, new data came out pointing to an economy that was strengthening slowly, but more rapidly than many had predicted. Over the last month alone, the unemployment rate dropped to 7 percent while the economy’s growth rate was revised upward significantly. On the last day of the year, new data showed that consumer confidence and home prices had risen more than expected.

The S.&P. 500 finished on Tuesday up 0.4 percent, or 7.29 points, at 1,848.36.

The Dow Jones industrial average rose 0.4 percent, or 72.37 points, to close at 16,576.66. It was up 26.5 percent for the year. The Nasdaq composite index was up 0.5 percent, or 22.39 points, to 4,176.59 — bringing its gains for the year to 38 percent.

The fear now is that investors have gotten ahead of themselves, paying too much for the actual earnings of corporate America. Shareholders are paying about $17 for every dollar of earnings from companies in the S.&P. 500. That is the highest the ratio has been since the current economic recovery began and above where it was in the optimistic years before the financial crisis began — though far below its ratio at the peak of the technology bubble.

Another significant concern is the Fed. The stock rally is attributed, in part, to the Fed’s stimulus programs and those of other central banks that followed suit. By buying bonds, the Fed pushed investors into riskier assets. The Fed has also allowed companies to borrow money at artificially low rates.

But with the Fed’s announcement in December that it would begin scaling back its bond purchases, many on Wall Street wonder whether investors will still be as eager to take risks. Problems could surface if the so-called tapering goes awry, a possibility given the extraordinary nature of the stimulus.

“The biggest risk is going to be a misstep by the Fed,” Mr. Morris said.

The uncertain outlook for interest rates could be particularly important for the housing market. Home prices have been rising, supporting the broader economic recovery, but those gains could slow if mortgage rates rise.

Economists have also been waiting for the economic gains to filter through to lower income Americans, whose wages and job prospects have stagnated. Then there are the persistent fears of another flare-up of economic problems in Europe or China.

But the consensus as the year ended was that stocks would probably continue to chug upward, albeit more slowly. The forecast among Wall Street strategists is for a 6 percent rise in the S.&P. 500, according to Bloomberg figures. That, though, is not far from the cautious predictions that kicked off 2013 and turned out to be wildly understated.