The length of time the Federal Reserve keeps its key interest rate near zero will depend on how far the U.S. economy remains from the central bank's employment and inflation goals, and how long it will likely take to meet them, Fed Chair Janet Yellen said on Wednesday.
Yellen, in her second public speech as Fed chair, largely restated the central bank's stance, stressed that it would respond to shifting economic conditions as it judges when to finally tighten monetary policy.
Read MoreRising rates may sting consumers
The stock market held onto most of the session's gains following Yellen's dovish remarks, with the Nasdaq flirting with a 1-percent rise. Treasurys ticked slightly lower. The five-year Treasury note saw buying ahead of Yellen's speech. Following it, thought, yields spiked as prices fell.
The central bank, frustrated with the slow U.S. recovery from recession, aims for maximum sustainable employment and a rise in inflation from just above 1 percent now to 2 percent.
"I hope it's completely clear that while monetary policy is very accommodating at this point, and I focused on the need to keep it so or to adjust it to make sure the recovery remains on track," Yellen said during a question-and-answer session at the Economic Club of New York. "As the recovery proceeds and healing occurs, it's obvious that we will need to tighten monetary policy to avoid overshooting our target."
She added that the Fed remains focused on removing accommodation when the time is right and that the central bank has learned that overshooting its target can be "very costly to reverse."
"The larger the shortfall of employment or inflation from their respective objectives, and the slower the projected progress toward those objectives, the longer the current target range for the federal funds rate is likely to be maintained," she said. "This approach underscores the continuing commitment of the (Fed's policy-setting committee) FOMC to maintain the appropriate degree of accommodation to support the recovery."
"The new guidance also reaffirms the FOMC's view that decisions about liftoff should not be based on any one indicator, but that it will take into account a wide range of information on the labor market, inflation, and financial developments."
Yellen also sought to tame any concerns about a recent run of disappointing economic data.
"In recent months, some indicators have been notably weak, requiring us to judge whether the data are signaling a material change in the outlook," Yellen said. "The unusually harsh winter weather in much of the nation has complicated this judgment, but my FOMC colleagues and I generally believe that a significant part of the recent softness was weather related."
Yellan also addressed the problems experienced in Europe -- saying that the area has been held back by its banking section though she said there has been progress.
It was Yellen's second major address in as many days. On Tuesday she said the Federal Reserve was considering adopting more measures to address the remaining financial-stability risks in the short-term wholesale funding markets.
Her speech Wednesday also comes amid a flurry of comments by Fed officials about the central bank's policy on rates guidance.
The Fed should try to make its communications on the expected path of interest rates and the economy consistent with its policy statements, the Atlanta Fed's Dennis Lockhart said Wednesday.
Meanwhile, the Boston Fed's Eric Rosengren said Tuesday the Fed should "explicitly" state that it will keep interest rates near zero until the U.S. economy is within one year of reaching the central bank's employment and inflation goals.
—Reuters with CNBC.com