NEW YORK (Reuters) - The S&P 500 ended flat on Tuesday and the Nasdaq posted modest gains as technology shares bounced from sharp losses in the prior session and comments from Fed Chair Janet Yellen boosted expectations of a December rate hike.

Yellen said the Fed needs to continue gradual rate hikes and it would be imprudent to leave rates on hold until inflation reached the Fed’s 2-percent target.

Earlier in the session, Atlanta Fed Chief Raphael Bostic, a non-voting member this year, said he would want “clear evidence” that prices were firming before committing to another rate increase, but did not rule out another hike in 2017.

Chances of a rate hike in December rose to 78 percent from about 40 percent a month ago, according to CME Group’s FedWatch tool.

“Investors should be looking out for a December hike given we don’t know what happens to the Fed chair position next year. (Yellen), probably wants to be able to, knowing anyone new in that role might not feel comfortable tightening the first month,” said Jack Ablin, chief investment officer at BMO Private Bank in Chicago.

Economic data showed U.S consumer confidence fell in September while home sales dropped to an eight-month low in August due to the impact of Hurricanes Harvey and Irma.

The Dow Jones Industrial Average .DJI fell 10.05 points, or 0.05 percent, to 22,286.04, the S&P 500 .SPX gained 0.23 points, or 0.01 percent, to 2,496.89 and the Nasdaq Composite .IXIC added 9.57 points, or 0.15 percent, to 6,380.16.

Technology .SPLRCT, up 0.4 percent, was the best performing major sector, recovering somewhat from losses in the prior session. Tech shares suffered their worst one-day drop in five weeks on Monday as concerns over tensions with North Korea prompted investors to book profits in what has been the best performing sector this year.

Apple AAPL.O rose 1.72 percent after four straight sessions of losses to help prop up the three major indexes, after Raymond James boosted its price target on the iPhone maker to $180 from $170.

“It is a little bit of a relief knowing perhaps investors still believe in buying the dips even after the Fed’s announcement of reduced balance sheet purchases,” said Ablin.

President Donald Trump warned North Korea any U.S. military option would be “devastating” for Pyongyang, but said the use of force was not Washington’s first option to deal with the North’s ballistic and nuclear weapons program.

Darden Restaurants DRI.N slumped 6.53 percent after the Olive Garden parent said it expected the negative effects on sales and earnings from Hurricane Irma to be about double that from Hurricane Harvey.

Red Hat RHT.N rose climbed 4.09 percent after the Linux distributor's quarterly profit came in above estimates and the company raised its full-year forecast.

Advancing issues outnumbered declining ones on the NYSE by a 1.31-to-1 ratio; on Nasdaq, a 1.35-to-1 ratio favored advancers.

About 5.81 billion shares changed hands in U.S. exchanges, compared with the 5.96 billion daily average over the last 20 sessions.