A speech by Federal Reserve Chair to a New York investment audience on Tuesday buoyed stocks as Janet Yellen said the central bank is still planning to raise rates eventually — but not for a while.

The Fed chair told the  Economic Club of New York that given the risks to the global economy, the central  bank will "proceed cautiously" in raising rates.

"Of course, economic conditions may evolve quite differently than anticipated in the baseline outlook, both in the near term and over the longer run," she said.

That was enough to send stocks higher, as the Dow Jones Industrial Average and broader S&P 500 both reversed earlier losses to rally in the afternoon.

All things being equal, low rates are good for stocks as that makes it cheaper to borrow to invest. Hiking rates tends to cool an overheating economy, which — broadly speaking — is not good news for stocks.

Although guarded, Yellen's comments say "this likely means she is unwilling to lift rates in April, though a move in June remains on the table if the economy picks up in the second quarter," BMO economist Sal Guatieri said in a note to clients after the speech.

Global concerns

Her speech came just days after other Fed officials caused a ruckus by suggesting an April rate hike could be in the cards.

After keeping its benchmark interest rate steady for more than six years, the Fed finally hiked its lending rate from above zero in December, saying at the time it deemed the U.S. economy was finally ready to start standing on its own two feet.

Since then, the world economy has fallen into a tailspin built on fears of slowing growth in China and Europe. Stock markets were in freefall for much of January, even as hard numbers on the U.S. economy continue to show an economy that's gaining strength.

Tuesday's speech was investors' first chance to hear Yellen speak since earlier this month, when she announced the central bank would stand pat on rates.

The bank is scheduled to meet again on interest rates next month, in the middle of April. Most economists are expecting no change at that meeting, but at least one more rate hike before the year is out.