U.S. stocks are flirting with all-time highs, climbing to levels not seen since before the financial crisis.

"The market environment is likely to get tougher in February and March as investors wrestle with the impact of fiscal tightening on the economy," said Russ Koesterich, BlackRock's global chief investment strategist.

What's behind the rally

There are a number of factors at play, including signs of improvement in Europe and sustained growth in China. But analysts say the Federal Reserve's stimulus moves have been the main driver.

The current bull market dates back to March 2009, but the rally really gained momentum after the Fed launched its second round of quantitative easing, or QE2, in 2010.

The bond-buying strategy, now in its third iteration, has coincided with a broad improvement in economic data and record profits for U.S. corporations.

But the rally is as much about what did not happen as what did.

The U.S. economy did not fall off the fiscal cliff, and lawmakers have delayed a showdown over the debt ceiling until mid-May.

The eurozone did not collapse under the weight of its crushing debt, thanks largely to aggressive moves by the European Central Bank.

And the Chinese economy appears headed for a soft landing, easing worries about demand in the world's second largest economy.

Investors were also drawn back into the market by attractive valuations, which is a fancy way of saying stocks were cheap.

Since the market bottomed in 2009, many large investors have been scooping up shares of companies that were beaten down in 2008. Many bank stocks, for example, were trading well below book value, which is the theoretical price their assets are worth minus their liabilities.

Bank of America(BAC) more than doubled in price last year as investors flocked to shares of companies in the financial services sector. JPMorgan Chase(JPM), Goldman Sachs(GS) and Morgan Stanley(MS) also bounced back.

Is now the time for investors to jump in?

The good news is that stocks still seem relatively attractive. The stocks in the S&P 500 are trading at roughly 14 times expected earnings for this year, which is reasonable.

But the trends that have supported stocks up until now are changing, and investors should be prepared to play defense, said Doug Cote, chief market strategist at ING Investment Management.

Cote pointed to corporate earnings, the life blood of stock returns, which are not growing as much as they had been.

At the same time, the latest economic data have been mixed, including a disappointing report on fourth-quarter GDP released Wednesday.

In a counter-intuitive twist, the weak GDP report could end up boosting stocks in the short term, since many investors believe it will lead to more Fed stimulus, said Krosby.

Wednesday afternoon, the Fed confirmed that it will continue its bond buying program. Still, it remains to be seen how the market will fare once the central bank stops buying bonds.

Meanwhile, after shunning stocks for the past few years, individual investors have started stepping back in.

"People are panicking that they missed the bull market and they're going to get in come hell or high water," said Cote. "But this is not a good time, the party is starting to be over."

Cote said the increased participation by individual investors is "a good thing," since they had been underexposed. But he warned that the market could be headed for a pullback.

"I think this thing comes back to Earth a lot faster than it went up," he said.