Stocks rallied to close higher on Friday after an afternoon slump on disappointing earnings reports from the high-tech sector.

All major indexes swung between gains and losses before ending with gains. The Dow Jones industrial average rose 56.13 points at 11,301.74 by close. The technology-dominated Nasdaq composite index edged up 5.16 points at 2198.84, while the broad Standard & Poor's 500 index was also up, gaining 4.46 points to close at 1.291.95.

Oil giant Exxon Mobil gained $1.47 to $90.20, and its gains helped curb the blue-chip Dow's decline earlier in the day. Exxon was also the winner in the race for a stake in Saudi Arabia's multibillion-dollar gas development initiative.

Investors took heart from a proposed aquisition of struggling Lucent Technologies Inc. Lucent shares gained 14 cents to $9.95 on a report it may be bought by Alcatel, according to the New York Times online edition on Friday, which cited executives close to the talks. Alcatel's American Depositary Receipts lost $1.89 to $30.15.

Talks between the two telecommunications equipment makers has reached a crucial stage and a decision about whether to proceed with formal negotiations is expected within the next week, the report said. Alcatel declined to comment.

Some dour profit reports from tech giants sent shares lower at the open.

Palm Inc. dropped to $5.02 after the hand-held computer maker said it cut its fiscal fourth-quarter outlook for revenues by half, and said it would take an inventory charge, citing snags in the sales of its products.

And Agilent Technologies Inc., which makes equipment to test networks, lost $2.47 to $36.25 after saying quarterly profits fell 42 percent as key orders from the communications and microchip industries collapsed. Agilent said the firm's backlog of orders had either been filled or canceled, so sales would drop sharply in the current quarter and it would post a loss.

The latest piece of economic data showed the U.S. international trade deficit in March widened to $31.17 billion from a revised $26.86 billion the month earlier. The trade gap was bigger than the $29.22 billion expected by analysts surveyed by Reuters.

Among other U.S. company-specific news, Merrill Lynch & Co. a leading investment bank, dropped $2.39 to $66.47. The company said it sold $2.04 billion of convertible senior bonds.

Gap Inc. reported earnings fell 51 percent, at the high end of analysts' estimates, as the No. 1 U.S. apparel chain continued to struggle against a dismal U.S. retail environment and sluggish sales at stores open at least a year. Shares slipped $0.95 to $33.95.

New shares of Global Power Equipment Group Inc. and Instinet Group Inc. surged on their first day of trading as public companies. Global Power jumped $11.45, or 57.25 percent, to $31.45, and Instinet climbed $3.15, or 21.72 percent, to $17.65.

The Russell 2000 index gained 1.26 to 506.02.

Overseas, Japan's Nikkei stock average fell 0.2 percent. In afternoon trading, Germany's DAX index was up 0.1 percent, Britain's FT-SE 100 was up nearly 0.2 percent, and France's CAC-40 was up 0.5 percent.

The Associated Press and Reuters contributed to this report