So much for that imminent market meltdown...

What happened to the global market selloff?
What happened to the global market selloff?

The American stock market is in the midst of a pretty sweet comeback.

Just two weeks ago the market was in full-fledged freak out mode over the crash in oil prices and depressing global growth. People were dumping stocks almost like it was 2008 all over again.

But cooler heads have prevailed, at least for the moment. Even after closing lower on Friday, the Dow is up a whopping 1,100 points since its lowest point on February 11. The S&P 500 has soared 4.7% over the past two weeks, its best stretch in exactly a year.

So what changed? First, fears of an imminent recession have faded -- and for good reason. The U.S. economy isn't in as terrible shape as the rest of the world -- nor as bad as investors thought just a few weeks ago.

Fourth-quarter growth was upgraded to a less terrible 1% on Friday and there's mounting evidence that consumer spending is accelerating in early 2016.

"The markets had gotten down to where a recession was at least halfway priced in," said Anthony Valeri, investment strategist at LPL Financial. "It's been a big reversal of that extreme pessimism."

That's why the Dow is now down "only" 4.5% on the year and the Nasdaq is no longer flirting with a bear market.

Related: The worst may finally be over for stocks

Oil and stocks move in lockstep

It's no coincidence that stocks bottomed the same day oil prices did. The turbulent commodity has surged a ridiculous 30% since the February 11 lows to nearly $35 a barrel.

That may not be great news for consumers filling up their gas tanks. But it is good for your retirement account because the stock market has become obsessed with the downsides of cheap oil, including job cuts and bankruptcies in the energy industry. For virtually all of this year the S&P 500 and oil have moved in lockstep -- for better or worse.

Of course, that means the stock market could experience another setback if oil makes another U-turn. Don't rule out that possibility. Oil prices are volatile and the world still has more than it needs. Saudi Arabia and Russia simply talking about freezing production -- without help from Iran -- won't fix the epic supply glut.

"Oil and stock prices appear joined at the hip," said Valeri. "It's hard to make the case for a sustained rally in oil prices."

But that hasn't prevented energy stocks from skyrocketing of late. Chesapeake Energy (CHK)is up 80% from its lows, while ExxonMobil (XOM) has soared 23%.

Oil isn't the only closely-watched commodity showing signs of life. Metals like copper and iron ore that serve as barometers of global growth have also stopped melting down, easing recession fears and lifting materials stocks like Freeport-McMoRan (FCX).

oil prices February

Related: Oil still has a chokehold on stocks

So where do stocks go from here?

In addition to the commodities complex, the markets will likely be dictated by the economy and the Federal Reserve.

The calmer mood in the markets and fading recession jitters may put interest rate hikes from the Fed back on the table. If the Fed signals it's planning to lift rates more aggressively than investors are comfortable with, another market temper tantrum is possible.

Still, investment strategists surveyed by CNNMoney believe the S&P 500 will end the year with a gain of 2.5%. That would be pretty good considering it was down as much as 11.4% this year at one point.

"I suspect we continue to put together piecemeal rallies, interrupted by spasms of 'risk-off' that ultimately allow for equity markets to regain some composure," Peter Kenny, an independent market strategist, wrote in a note.

CNNMoney Sponsors