Dow Jones Industrial Average
Traders work on the floor of the New York Stock Exchange on March 7, 2016. Platt/Getty Images

This story was updated at 4:30 p.m. EDT.

U.S. stocks erased early-day losses to close in the green Tuesday after U.S. Fed Chair Janet Yellen suggested no change to U.S. borrowing rates was forthcoming.

The Dow Jones Industrial Average (INDEXDJX:.DJI) gained 98 points Tuesday, or 0.56 percent, to 17,633.11. The broader Standard & Poor’s 500 index (INDEXSP:.INX) rose 18 points, or 0.88 percent, to 2,055. The Nasdaq composite (INDEXNASDAQ:.IXIC) advanced 80 points, or 1.67 percent, to 4,847.

All 10 S&P 500 sectors closed up Tuesday following Yellen’s comments, led by tech and healthcare stocks. Apple Inc. (NASDAQ:AAPL) led Dow advances while industrial technology concern 3M Co. (NYSE:MMM) led declines.

In other U.S. economic news, home-price data released before markets opened showed gains that were in line with expectations while official data on U.S. consumer confidence showed a better-than-expected rebound in March.

The Fed gave a much more cautious stance on raising interest rates in its meeting earlier this month, but since then several Fed officials, including St. Louis Fed President James Bullard and Philadelphia Fed President Patrick Harker, have made more hawkish comments that suggest a hike in borrowing costs as early as next month.

"Last week we heard a lot of hawkish rhetoric from a succession of Federal Reserve policymakers, about the potential for a move on rates in April, with most citing the strength of the U.S. economy,” Michael Hewson, chief market analyst at U.K.-based CMC Markets, wrote in a note Tuesday.

Dialing U.S. interest rates back to normal historical levels has been the goal of the Fed for years. It would indicate a normalization of the U.S. economy. Currently, the Fed-funds rate range stands at between 0.25 and 0.50 percent, well below a historical average of about 6 percent. The next hike would be modest, possibly taking the rate to as much as 0.75 percent.

The reason why Fed policy is so closely tracked by investors is because raising rates lowers corporate earnings by increasing the cost of borrowing. Low borrowing rates have stimulated both U.S. economic growth and stock prices. So every time investors think Fed rate hikes are in the works, stocks are pushed down. Banks stocks are a big exception to that: low interest rates means they make smaller margins on loans so their stock falls along with the perception that rates will remain low.

A monthly Conference Board survey released Tuesday morning showed that U.S. consumer sentiment rose in March after retreating in February. The Consumer Confidence Index hit 96.2 in March, the trade group said, up from 94.0 in February. This closely tracked survey measures sentiment toward business conditions, personal finance and jobs. The report comes a day after the U.S. Commerce Department said consumer spending edged up a tepid 0.1 percent in February and greatly downgraded January’s preliminary estimate to 0.1 percent growth from of 0.5 percent growth.

Private-sector data released Tuesday before markets opened in New York showed that home prices in major U.S. metropolitan areas rose 5.7 percent in January compared to the same month last year, which was largely in line with economists’ forecasts. The data shows that housing continued to greatly outpace inflation, a positive signal for the economy indicating robust demand. But financing for young, first-time buyers continues to be a concern, says David M. Blitzer, managing director and chairman of the index committee at S&P Dow Jones Indices. The S&P Case-Shiller U.S. National Home Price Index, which measures nine regional U.S. census divisions, was up 5.4 percent year over year in January.

Oil prices turned lower Tuesday as traders fret that a two-month mini-rally that’s pushed prices up about 45 percent since mid-February is waning. Major oil producers, including OPEC, will meet in Doha on April 17 to discuss crude output freezes in an effort to stabilize prices.

U.S. West Texas Intermediate was down 2.11 percent to $38.56 after topping $40 last week for the first time since early December. Brent crude, the other major global oil-price benchmark, lost 2.23 percent to $39.37.

The benchmark U.S. 10-year Treasury fell to 1.808 percent Tuesday morning from Monday’s settlement yield of 1.876 percent. The bond yield typically rises when investors are more confident about the markets and falls when concerns flare and demand for U.S. debt increases. Gold, another so-called safe harbor investment, gained 1.29 percent to $1,225.80 per troy ounce. Gold prices tend to rise as confidence in the markets falls.

European shares were mixed in Tuesday-afternoon trading ahead of Yellen’s speech.

The broad pan-European Stoxx Europe 600 closed up 0.45 percent. The Paris-based CAC 40 gained 0.85 percent while London’s FTSE ended the day almost where it started, down 0.01 percent. Frankfurt’s DAX closed up 0.37 percent .

Most Asian stock markets ended the day lower as investors backed away from risk ahead of Yellen’s comments.

Japan’s Nikkei 225 closed lower by 0.18 percent. Hong Kong’s Hang Seng ticked up a slight 0.1 percent. Australia’s S&P/ASX 200 lost 1.57 percent. South Korea’s main Kospi Index advanced 0.62 percent. China’s broad CSI 300 Index of the mainland’s largest companies closed down 1.08 percent.