NEW YORK (MarketWatch) — U.S. stocks posted slight gains Wednesday, with the Dow Jones Industrial Average capping its longest win streak in more than 16 years after February retail sales beat expectations.

The figures from the Commerce Department had retail sales up 1.1% last month, the largest gain in five months and better than forecast.

“The numbers were very good; the consumer is showing incredible resilience, having absorbed the dysfunction in Washington and the payroll-tax increase,” said Ron Florance, managing director of investment strategy for Wells Fargo Private Bank.

Retailers including Best Buy Co. BBY, -0.81% rose in the wake of the upbeat data.

Erasing losses, the Dow Jones Industrial Average DJIA, +0.13% advanced 5.22 points to 14,455.28, with the blue-chip index posting a seventh day of record closes.

Retail sales beat expectations

The finish marked a ninth straight day of gains, the Dow’s longest such run since a 10-session win streak that ended Nov. 15, 1996.

“The stock market has basically been playing catchup. People had so much money on the sidelines, and now they realize the world is not coming to an end,” said Florance of the market’s advance that has the S&P 500 index up 9% this year.

Less than 11 points from its all-time closing high, the S&P 500 index SPX, -0.46% added 2.04 points, or 0.1%, to 1,554.52, with consumer discretionary faring best and telecommunications the worst performer among its 10 major industry groups.

“The retail investor is going to start looking at this market and seeing some opportunity, as we saw yesterday; dips are a potential buying opportunity,” said Joe Cusick, senior vice president of education at OptionsXpress.

The Nasdaq Composite COMP, -1.25% climbed 2.80 points, or 0.1%, to 3,245.12.

For every three stocks sliding, roughly four gained on the New York Stock Exchange, where almost 585 million shares traded.

Composite volume topped 3 billion.

Netflix Inc. NFLX, -2.44% shares rallied 5.6% after the online video service started new social features with Facebook Inc. FB, -3.26% .

Spectrum Pharmaceuticals Inc. SPPI, +1.08% tumbled more than 37% after the developer of cancer treatments projected 2013 sales below expectations.

Walgreen Co. US:WAG gained 4.2% after UBS hiked its rating on the drugstore chain to buy from neutral.

Ahead of Wednesday’s open, stock futures had erased losses after the government reported retail sales jumped in February, enhancing the view of an ongoing economic recovery. Another release from the Commerce Department had business inventories rising 1% in January.