U.S. stocks tumbled Thursday, with the S&P 500 and Dow industrials logging their worst one-day declines since May as the technology sector resumed its selloff, overshadowing advances in financials.

The Dow Jones Industrial Average DJIA, +1.33% fell 167.58 points, or 0.8%, to 21,287.03, its biggest percentage decline since May 17. The S&P 500 index SPX, +1.59% declined 20.99 points, or 0.9%, to 2,419.70, also its worst selloff in more than a month. The Nasdaq Composite Index COMP, +2.26% tumbled 90 points, or 1.4% to 6,144.35.

The Nasdaq has registered its third straight session with a move of 1%, including a slump of 1.6% on Tuesday and Wednesday’s 1.4% rally—its biggest one-day rise since Nov. 7.

The outsize moves in all three sessions came on volatility in the technology sector XLK, +2.39% , which fell 1.8%. Among the biggest decliners in the sector were Microsoft Corp. MSFT, +2.27% Google-parent Alphabet Inc. GOOGL, +1.13% and Apple AAPL, +3.75% .

The losses in tech were so severe on Thursday that all but one of its components, DXC Technology Co DXC, +0.86% , ended in negative territory. Tech shares have struggled in recent weeks, with the sector down 2.5% thus far this month amid concerns the group’s rally may be running out of steam at a time when valuations are stretched by many metrics.

“If you were to pick one particular point influencing trading right now, it would be that people think the large-cap tech stocks are overvalued right now,” said Wayne Kaufman, chief market analyst at Phoenix Financial Services. “I’m bullish on tech, especially semiconductor stocks, but there are concerns that it is an overcrowded trade, and that they’d be vulnerable if the economy slowed.”

On the upside, financial shares XLF, +1.03% rose 0.7% after the 34 biggest U.S. banks passed the Federal Reserve’s stress test and received a green light for plans to return capital to shareholders. The Fed determined the country’s biggest banks have “strong” levels of capital and would be able to keep lending even during a severe recession.

Goldman Sachs GS, -0.08% rose 0.5% while J.P. Morgan Chase & Co. JPM, +0.87% added 1.5%. Citigroup Inc. C, -0.40% advanced 2.8%.

“We’ve had some major players in the financial sector be overly impacted in a negative way for a long time. They’ve been beaten down, but news like this could help them become one of the leading sectors in the second half of the year,” said Kevin Miller, chief executive officer of E-Valuator Funds, which have about $150 million in assets.

Meanwhile, Treasury Secretary Steven Mnuchin told reporters at a White House news conference that the financial markets shouldn’t be worried about the debt ceiling. The U.S. government’s borrowing limit will have to be raised soon to stave off default. Mnuchin also announced a series of new sanction against North Korea in a bid to discourage and punish the country for its nuclear weapons program.

Bonds shadow central banks: Financial shares have also been tracking a rise in long-term Treasury yields TMUBMUSD10Y, 0.657% . A selloff in U.S. and European bonds on Thursday sent yields higher as investors maneuvered around potential moves by the Federal Reserve, the European Central Bank and the Bank of England. Bond prices and yields move inversely.

“Comments from central bankers in recent days suggest that perhaps it will not be too long before the Fed is joined by other central banks in tightening monetary policy,” said Richard Perry, market analyst at Hantec Markets.

“In recent days, there have been hawkish indications from the ECB’s Draghi, the Bank of England’s Carney and Bank of Canada’s Poloz, all of which have signaled a potential end to their easing programs could be close,” he noted.

Buck under pressure: The ICE Dollar Index DXY, +0.23% , which measures the U.S. dollar against a basket of six currencies, was down less than 0.1% to 95.57, but has fallen 1.8% so far this week.

“Playing currencies is a game of relatives, and with traders questioning the Fed’s ability to tighten in light of subdued inflation, the dollar is under pressure,” said Perry.

Both the euro EURUSD, +0.00% and the pound GBPUSD, -0.02% have marched higher against the greenback, he noted.

The weaker dollar was seen as giving a boost to some dollar-denominated commodities, such as oil and copper, on Thursday. Those moves could aid resource-related stocks on Wall Street.

Economic docket: In the latest economic data, the latest revision to first-quarter GDP was raised to 1.4%, up from the previous estimate of 1.2% and double the initial 0.7% read.

Separately, jobless claims rose by 2,000 in the latest week, although they remain at levels that are extremely low from a historical standpoint.

See: MarketWatch’s economic calendar.

On the Fed front, St. Louis Fed President James Bullard said the current level of interest rates is appropriate for the low-growth, tepid inflation environment and the central bank doesn’t need to act in response to future developments. Bullard isn’t on the Fed’s current rate-setting board. His comments capped a busy week of central-bank speakers.

Stocks in focus:Rite Aid Corp. RAD, -8.92% tumbled 26.5% after Walgreens Boots Alliance Inc. WBA, +1.14% canceled its merger agreement with Rite Aid. Instead, Walgreens is buying 2,186 Rite Aid stores and related assets, sending Walgreens shares up 1.7%. In a related move, shares of Fred’s Inc. US:FRED plunged 23% after a deal to buy some Rite Aid stores was terminated.

Blue Apron Holdings Inc. APRN, +6.27% ended at its offering price of $10 dollars in its debut as a publicly listed company, valuing the meal-kit delivery company at $1.9 billion.

Read:Why Blue Apron’s valuation just got slashed

Pier 1 Imports Inc. US:PIR tumbled 8.4% after it reported first-quarter revenue that missed expectations.

Other markets: Gold US:GCQ7 ended lower while oil prices US:CLQ7 rose for a sixth straight day, with the dollar slump and a sizable weekly decline in U.S. crude production seen as factors.

Stock markets in Asia NIK, +0.50% HSI, -0.32% rose, but European benchmarks SXXP, -0.09% were feeling the weight of a rising euro.

Behind the Glass: How the iPhone was born

—Carla Mozee contributed to this article