News of a terrorist attack in Barcelona that left at least a dozen people dead sent the market tumbling Thursday.

The Dow fell more than 274 points, about a 1.2% drop. All 30 of the stocks in the index were in the red. It was the biggest decline for the Dow since May, when it plunged more than 370 points.

The S&P 500 declined 1.5% and the Nasdaq was down nearly 2%.

Stocks were already having a bad day because of lingering concerns over President Trump's rift with business leaders.

Uninspiring earnings and outlooks from Dow components Walmart (WMT)and Cisco (CSCO) didn't help matters. But the market hit its lowest spot of the day after the reports of the attack in Spain.

The VIX (VIX), an index that measures volatility, surged more than 30%. CNNMoney's Fear & Greed market sentiment index includes the VIX, and it fell into "extreme fear" levels.

Go to CNN for more coverage of the attack in Barcelona

Airline stocks were among the bigger losers Thursday, with American (AAL), Alaska Air (ALK) and Delta (DAL) among the 10 worst performers in the S&P 500.

The big carriers tend to get hit when people worry about terrorism and the possible impact on global travel.

An exchange traded fund that owns leading companies in Spain also fell after the attack. The iShares MSCI Spain ETF (EWP) was down more than 2%, led by drops in Banco Santander (SAN)and Telefonica (TEF).

Gold prices rallied though. The metal often spikes in times of geopolitical turmoil because it is viewed as a classic flight to safety investment.

Still, it's also important to note that the stock market remains near record highs despite the recent selloff. The Dow is up more than 10% this year while the Nasdaq has gained 16%.