NEW YORK (AP) _ A worse-than-expected trade deficit undermined the stock market Tuesday, driving the Dow Jones industrial average to a second decline after a nine-day rally.

The Dow Jones average of 30 industrials fell 8.73 points to 2,544.76.

The Commerce Department announced before the market opened that the nation's merchandise trade deficit rose to $10.24 billion in May, well above expectations of a $9 billion gap.

The trade report undercut the dollar, which carried over to weakness in bonds. The stock market opened lower and never recovered.

Some analysts said the stock market showed underlying strength by holding up as well as it did.

''It gives ground grudgingly. There's still lots of cash on the sidelines,'' said Alan Ackerman, a Gruntal & Co. analyst in New York.

''For a necessary pause that refreshes, this just isn't that dangerous,'' agreed Lawrence Wachtel, an analyst at Prudential-Bache Securities Inc. in New York.

Still, two down sessions in a row have put a chill on the July rally, which saw the Dow Jones average rise 114.76 from the end of June through last Friday's close.

Tuesday's market decline, although modest, was more pronounced than Monday's, when the Dow Jones industrial average slipped just 1.33 and advancing stocks narrowly outnumbered declining ones.

On Tuesday decliners outnumbered advancers by about 11 to 8 in nationwide trading of New York Stock Exchange-listed stocks, with 618 up, 850 down and 540 unchanged.

Volume on the floor of the Big Board came to 152.35 million shares, up from 131.96 million in the previous session.

Nationwide, consolidated volume in NYSE-listed issues, including trades in those stocks on regional exchanges and in the over-the-counter market, totaled 187.14 million shares.

Marion Laboratories led the list of most actively traded issues, rising 1 to 34 1/2 , after the announcement Tuesday that Dow Chemical had signed a definitive agreement to acquire 67 percent of its stock over the next two or three years. It had gained 8 1/4 points on word of a tentative agreement Monday.

More than 13 million Marion shares changed hands in composite dealings, adding significantly to overall trading volume. Dow Chemical, meanwhile, fell 1 5/8 at 86 3/4 .

International Business Machines, a blue-chip bellwether, fell 1 to 114 3/4 in spite of an earnings report that met expectations. The 39 percent quarterly gain was largely the result of special factors. The stock had risen by an identical amount Monday.

Apple Computer fell 1 1/2 to 39 1/4 in heavy over-the-counter trading after reporting a 5.3 percent earnings gain, below market expectations.

Holiday, owner of Holiday Inns, jumped 6 1/4 to 57 1/4 . A Drexel Burnham Lambert research report said a ''golden parachute'' provision for senior executives gives them a strong incentive to consider selling them the company later this year.

B.F. Goodrich jumped 2 3/8 to 64. USA Today reported that Centaur Partners, a New York investment group, and a European company other than Hanson PLC of Britain were considering an $85-a-share takeover offer. The stock had climbed 3 1/4 on Monday on speculation of a bid by Hanson.

Warner Communications rose 1/4 to 65 5/8 , Paramount Communications rose 3/4 to 57, and Time fell 3 to 138. The companies are embroiled in a three-way takeover battle.

As measured by Wilshire Associates' index of more than 5,000 actively traded stocks, the market fell $7.12 billion, or 0.22 percent, in value.

The NYSE's composite index of all its listed common stocks fell 0.46 to 184.91.

Standard & Poor's industrial index fell 0.94 to 378.73, and S&P's 500-stock composite index fell 1.09 to 331.35.

The NASDAQ composite index for the over-the-counter market fell 2.02 to 447.86. At the American Stock Exchange, the market value index closed at 370.17, up 0.62.