U.S. stocks struggled to retain gains on Friday, retreating from opening highs in the latest example of choppy intraday action as investors adjust to an economic environment marked by the possibility of both higher inflation and borrowing costs.

What are the main benchmarks doing?

The Dow Jones Industrial Average slumped by 51 points, or 0.2%, to 23,809, having earlier risen as high as 24,209.50. The S&P 500 was flat at 2,580. The Nasdaq Composite Index gave up 5 points, or less than 0.1%, to 6,772.

At current levels, the Dow down is off 10% from its all-time high while the S&P 500 is 9.7% below its own and the Nasdaq is down 9.2%.

According to financial blog SentimenTrader, Thursday's drop marked the Dow's fourth-fastest decline into correction territory from an all-time high, based on data that goes back to 1897.

Based on Thursday's close, 96 of the S&P 500's components are in bear market territory (http://www.marketwatch.com/story/more-than-10-of-sp-500-stocks-are-in-a-bear-market-2018-02-08), defined as a 20% drop from a peak. Only 88 of the component aren't in correction territory.

(https://twitter.com/RyanVlastelica/status/961708128927657984)

The Cboe Volatility Index fell 5% to 31.77. The so-called "fear index" has nearly tripled thus far this year; the S&P has undergone six sessions with a 1% move in 2018 (through Thursday's close), nearly equaling the number of such moves seen over the entirety of 2017.

Don't miss:Jim Cramer blames a 'group of complete morons' for blowing up the market (http://www.marketwatch.com/story/jim-cramer-blames-a-group-of-complete-morons-for-blowing-up-the-market-2018-02-08)

What's driving markets?

Driven by volatility worries and inflation concerns, stocks are facing their worst weekly performances in months. The Dow has lost 6.4% while the S&P is down 6.3% and the Nasdaq is off 6%. It is the biggest weekly percentage decline for both the Dow and the S&P since September 2011 and the biggest for the Nasdaq since January 2016.

The Dow has suffered a pair of 1,000-point drops this week, including in Thursday's session. That decline, which accelerated throughout afternoon trading, sparked global selling on Friday. Meanwhile, Europe was broadly lower as was Asia. Chinese stocks bore the brunt of the blow, dropping as much as 6% at one point.

In what could remove one political headwind from the market, President Donald Trump signed legislation to end a brief government shutdown after the House and Senate approved a budget deal (http://www.marketwatch.com/story/senate-passes-budget-deal-as-government-remains-shut-down-2018-02-09).

"Right now markets are moving more on the emotions of trading, rather than economic fundamentals. Once the fears get rolling, it's purely sentiment and what traders can imagine in terms of where things can be going that drive price action," said Bruce McCain, chief investment strategist at Key Private Bank.

"We could have fallen enough to account for the new inflation fears, but we need to form a pretty stable base before investors can feel reassured the bottom won't fall out from under them, and it will take some more price action before that occurs."

The day's gains were broad, with nine of the 11 primary S&P 500 sectors up on the day. Technology led the advance, rising 1.4%. That was boosted by some positive earnings in the space. FireEye Inc. (FEYE) shares surged 11% after the software-security company revealed its first quarterly profit (http://www.marketwatch.com/story/fireeye-earnings-show-first-quarterly-profit-stock-jumps-more-than-12-2018-02-08). Separately, Nvdia Corp.(NVDA) jumped 7.4% after upbeat earnings ().

On the downside, Expedia Inc.(EXPE) slid 13% after a wide earnings miss ().

A notable loser was energy, which lost 1% alongside a 2.2% drop in the price of crude oil

Exxon Mobil Corp. (XOM) fell 0.1%, erasing an earlier gain of more than 1%. The stock was on track for its sixth straight daily decline. The energy giant has lost 11% thus far this week, on track for its biggest weekly percentage loss since October 2008, during the worst of the financial crisis.

What are other assets doing?

European stocks (http://www.marketwatch.com/story/european-stocks-head-lower-after-wall-street-fails-to-rebound-2018-02-08) were headed for the worst week in two years (http://www.marketwatch.com/story/european-stocks-head-for-worst-week-in-2-years-as-global-selloff-rages-on-2018-02-09), while Wall Street's late plunge hit Asia markets hard (http://www.marketwatch.com/story/asian-markets-skid-after-wall-street-sinks-into-correction-territory-2018-02-08), with several indexes posting their worst week in years. The Shanghai Composite Index closed down 4%, after losing as much as 6% in the session, while the Nikkei 225 index dropped 2.3%.

After trading above 2.80% all of Thursday's session, the yield on 10-year Treasury notes remained elevated, at 2.843%.

Gold futures were modestly lower, while crude-oil futures fell over 1%, and the ICE U.S. Dollar Index was moving up.