Updated from 4:05 p.m. EDT

Stocks ended lower Tuesday, as terrorist attacks in the Middle East and negative analyst comments gave investors a reason to take some money off the table after a two-day rally.

The Dow Jones Industrial Average ended down 47 points at 8679, while the Nasdaq fell almost 2 points to 1539. The S&P 500 shed 3 points to 942. Over the past two days, the Dow had climbed 235 points, or almost 3%, while the Nasdaq had jumped 52 points, or 3.5%.

"I just think we've come a long way and are taking a breather," said Peter Blatchford, trader at Miller Tabak & Co. "We've pretty much shrugged off the events in Saudi Arabia."

Dozens of people were killed, including seven Americans, in explosions at a residential compound that housed Westerners in Riyadh. Secretary of State Colin Powell condemned what he termed terrorist attacks that had "earmarks" of al Qaeda.

"The bombing in Saudi Arabia, the wider trade deficit and the downgrade in the semiconductors gave investors three reasons to take profits off the table," said Peter Cardillo, chief strategist at Global Partners Securities. "But I think we're digesting the news pretty well; it's not as if we're falling off a cliff or anything."

Cardillo said the weaker dollar is now being perceived as a short-term positive, and he noted that the trade deficit revealed a small increase in exports.

Still, some analysts are increasingly concerned about a bigger pullback in the market after recent gains. Bear Stearns analyst Francois Trahan reduced his recommended equity asset allocation to 60% from 65%, and increased his cash weighting to 15% from 10%.

"We continue to believe that 2003 will prove to be a better year for equities, but our valuation model argues that much of the good news to come for stocks is already priced in," he wrote. "Technical indicators of overbought/oversold readings mostly argue for a coming pullback in the stock market."

Trahan set an S&P 500 target of 1,025 for the end of 2004.

The day's economic news also suggested that stocks might have advanced too much recently. The U.S. trade deficit ballooned in March to its second-widest level on record, as a big gain in oil prices pushed oil imports up to a record $9.1 billion. Although imports were up sharply, exports also rose slightly, aided by a weaker dollar.

Donald Straszheim, strategist at Straszheim Global Advisors, said that while it's still possible the market breaks through its October lows, he doesn't believe that's likely to happen.

"When we look at a basket of stocks -- big well-known names, in many industries -- they are far above their recent bottoms, and we doubt they will retrace all of that territory," he said. Still, he did note that sharp run-ups like this are typically followed by a sharp reversal.

In corporate news, Wal-Mart ( WMT) posted a 14% rise in first-quarter net income, in line with estimates of 42 cents per share, and up from 37 cents a share a year earlier. The retailer said a weaker dollar and cost cutting helped the results. Shares fell 2% to $55.49.

J.C. Penney ( JCP) earned $61 million, or 20 cents a share, in the latest quarter, down from $86 million, or 29 cents a share, last year. The latest quarter's earnings topped estimates by 2 cents a share. Shares rose 5% to $18.85.

Merrill Lynch downgraded five chipmakers' stocks to neutral from buy on concerns that demand for their products will falter: ATI Technologies ( ATYT), Intersil ( ISIL), Maxim Integrated ( MXIM), Nvidia ( NVDA) and Semtech ( SMTC). The Philadelphia Semiconductor index fell 0.8% to 355.

Schering-Plough ( SGP) posted sharply lower first-quarter earnings and revenue because of generic competition for the allergy drug Claritin. Net income fell to 12 cents a share from 41 cents in the year-ago period. The company's new CEO also said he was "withdrawing" 2003 earnings guidance as he tries to get a handle on Schering's financial condition. Shares were up 2% at $18.71.

If you liked this article you might like

Coming Week: Earnings Flood

Coming Week: Earnings Flood

Don't Write Off Inflation Threat

Don't Write Off Inflation Threat

No Quick Fix for Trade Gap

No Quick Fix for Trade Gap

Merrill's Doll Sees Stocks 'Muddling Through'

Merrill's Doll Sees Stocks 'Muddling Through'

Downhill From Profit Peak

Downhill From Profit Peak