US Markets

Stocks close higher on dovish Yellen remarks; S&P, Dow set records

Yellen goes for gradualism and flexibility: Cashin
VIDEO0:3400:34
Yellen goes for gradualism and flexibility: Cashin

U.S. stocks closed at highs on Tuesday as Fed Chair Janet Yellen's congressional testimony indicated that a rate hike would likely come later rather than sooner.

The testimony has "certainly got something for everyone on the market today. It's right down in the middle of the fairway and leaves the window open for a June or September (rate hike)," said Art Hogan, chief market strategist at Wunderlich Securities.

Stocks climbed to new records amid Yellen's remarks to the Senate Banking, Housing and Urban Affairs Committee on Tuesday. She will address the House Financial Services Committee on Wednesday.

Read MoreJanet Yellen: Don't audit the Fed

The Dow Jones industrial average briefly gained more than 100 points to set a new intraday record of 18,231.09, led by 4 percent gains on Home Depot.

The S&P 500 advanced to touch a new intraday high at 2,117.99.The Nasdaq closed positive at 15-year highs for its 10th consecutive day of gains.

"Almost every day markets are driven by central bank policy, whether it's the Fed, the ECB, Bank of Japan," said Peter Boockvar, chief market analyst at The Lindsey Group. "Economic fundamentals have not been dragging markets down. It's another day of 'Yellen is noncommittal, therefore buy stocks.'"

Yellen's prepared remarks said no rate hike is expected for the next few FOMC meetings. She later said in a question-and-answer session that the Fed would not raise rates before it found confidence in the economic recovery, overcoming current concerns about the labor market, below-objective inflation and the decline in energy prices.

"Once again, Ms. Yellen seems to be trying extremely hard to persuade investors and market participants that, while an inevitable increase in interest rates is likely to happen, when it does it should not take anyone by surprise. In addition, when the Fed moves, it will not be substantial," Andrew Wilkinson, chief market analyst at Interactive Brokers, said in a note.

Eric Stein, portfolio manager in the Global Income Group at Eaton Vance, said the Fed chair's remarks were "in-line to a little hawkish."

Read MoreYellen takes it slow, and that pleases markets

"I think June is still very much in play but it's all going to be very data dependent," he said, noting that the labor market will need to show continued strength in order for a rate hike to come in the second half of this year.

The Fed funds futures indicated that the first meeting with a better-than-average chance of a rate hike is October, after the chance for a rate hike in September fell to 48 percent from 50 percent earlier today, according to CME Group data.

Short-term yields spiked following the statement's release. The 10-year Treasury yield initially held steady near 2.08 percent before falling to below 2.00 percent after the conclusion of Yellen's Senate testimony.

The decline is "another indication that this testimony was on the dovish side," said Peter Cardillo, chief market economist at Rockwell Global Capital. "The (equity) market is probably going to rally here and close the month on a strong note."

He said the S&P 500 could reach 2,125 or 2,150 this week before pulling back next month.

Futures moved little on the news before the bell that Eurozone finance ministers officially approved a four-month bailout extension for Greece.

The country sent its economic reform plans—which include measures to crack down on tax evasion and corruption—to the euro zone overnight.

In Europe, equities closed higher on Tuesday, encouraged by Yellen's dovish statements and resolution in Greece.

U.S. stocks pulled back from Friday's records to close narrowly mixed on Monday.

Read More'Healthier' Nasdaq set for record: What to buy

On the data front, the S&P/Case-Shiller composite index of home prices in 20 cities increased by 4.5 percent in December from the same period last year.

However, home builder Toll Brothers easily topped estimates on earnings and revenue as the firm sold more homes at higher prices. Toll earned 44 cents per share for its first quarter, well above estimates of 30 cents.

U.S. consumer confidence fell more than expected in February, pulling back from a multi-year high according to a private sector report released on Tuesday.

Financial data firm Markit said its preliminary reading of its Purchasing Managers Index for the service sector rose to 57.0 in February from 54.2 in January, indicating that the U.S. services sector expanded in February at its fastest pace since October, with businesses reporting more orders because of improving economic conditions.

Major U.S. Indexes


The Dow JonesIndustrial Average closed up 92.35 points, or 0.51 percent, at 18,209.19, with Home Depot leading gains and UnitedHealth the greatest laggard.

Home Depot posted fourth-quarter earnings that beat expectations, with ex-items earnings of $1.00per share, up from 73 cents a share in the year-earlier period. Revenueincreased to $19.2 billion from $17.7 billion a year ago. Same-store sales rose7.9 percent in the quarter.

The closed up 5.83 points, or 0.28 percent, to 2,115.49, with utilities leading gains and health care the only sector of 10 declining.

The Nasdaq closed up 7.15 points, or 0.14 percent, to 4,968.12.

The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, traded below 14.

The U.S. dollar traded flat against major world currencies.

Read MoreThese outperform after Yellen gives a speech

Advancers were a step ahead of decliners on the New York Stock Exchange, with an exchange volume of 515 million and a composite volume of nearly 2.8 billion just before the close.

High-frequency trading accounted for 47.5 percent of February's average daily trading volume of approximately 7 billion shares, according to TABB Group. During the peak levels of high-frequency trading in 2009, about 61 percent of 9.8 billion of average daily shares traded, were executed by high-frequency traders.

Crude oil futures settled down 17 cents to $49.28 a barrel on the New York Mercantile Exchange. Gold futures settled down $3.50 to $1,197.30 an ounce.

Oil initially declined as doubts about an emergency OPEC meeting emerged, and later reversed most of those losses on news that Libya's largest oilfield stopped production. Traders also awaited U.S. oil inventory data on Wednesday to see whether it would show another large increase.

Macy's reported earnings for the holiday quarter that missed analyst estimates.

Read MoreEarly movers: HD, CMCSA, TOL, ODP, JPM & more

Comcast, the NBCUniversal parent, earned an adjusted 77 cents per share for the fourth quarter, 1 cent below estimates, though revenue was above Street forecasts. Comcast raised its annual dividend by 11 percent to $1 per share and increased its share repurchase authorization to $10 billion.

Hewlett-Packard, Lending Club, Boston Beer, Dreamworks Animation, First Solar, La Quinta and Newfield Exploration are due after the bell.

Reuters and CNBC.com contributed to this report.

On tap this week:

Tuesday

Earnings: Hewlett-Packard, Boston Beer, Dreamworks Animation, First Solar, Papa John's(tentative), WebMD Health

Wednesday

Earnings: Lowe's, Campbell Soup, ChesapeakeEnergy, Dollar Tree, Target, TJX, SodaStream, L Brands, Liberty Media,Salesforce.com, Transocean, Workday

7:00 a.m.: Mortgage Applications

10:00 a.m.: New Home Sales

10:00 a.m.: Janet Yellen speaks

10:30 a.m.: Oil inventories

1:00 p.m.: Five-year note auction

Thursday

Earnings: A-B InBev, Kohl's, Chico's FAS,SeaWorld, Autodesk, Gap, Ross Stores, United Health Services, Herbalife, JCPenney, Live Nation Ent., Splunk, Weight Watchers

8:30 a.m.: CPI

8:30 a.m.: Durable Goods orders

9:00 a.m.: FHFA Home Price Index

10:30 a.m.: Natural gas inventories

11:00 a.m.: Kansas City Manufacturing Index

12:40 p.m.: Fed's Lockhart speaks

1:00 p.m.: Seven-year note auction

4:30 p.m.: Fed balance sheet/money supply

Friday

8:30 a.m.: GDP

9:45 a.m.: Chicago PMI

10:00 a.m.: Consumer Sentiment

10:00 a.m.: Pending Home Sales

10:15 a.m.: Fed's Dudley speaks

10:15 a.m.: Fed's Mester speaks

1:30 p.m.: Fed's Fischer speaks

3:00 p.m.: Farm prices

More From CNBC.com: