The Toronto stock market ended flat on Tuesday as a surge in the price of oil and a takeover deal for Western Oil Sands offset weakness in telecoms and a plunge in Rogers Communications.

The S&P/TSX composite index closed up 3.91 points at 13,868.63.

Only four of the 10 main TSX sectors posted gains.

The energy group jumped 1.5% as U.S. crude oil futures rose toward a record high above US$78 a barrel on expectations that an inventory report due Wednesday would show U.S. crude stocks fell last week. The September crude oil contract on the New York Mercantile Exchange set a new closing record, ending up $1.38 to US$78.21.

Western Oil Sands shot up $3.19, or 9.4%, to $37.32 after Houston-based Marathon Oil said it will buy Western for about $5.56 billion.

Suncor Energy announced it is seeking regulatory approval for a $4.4 billion expansion of its oil sands mining operations. Suncor shares climbed $1.68, or 1.8%, to $96.45.

Media and telecom company Rogers Communications led the TSX downside, battered by both its report of a second-quarter loss and comments that it is not interested in buying Shaw Communications.

Rogers shares slid $2.84, or 5.6%, to $48.22, while Shaw slipped 88¢, or 3.4%, to $25.30.

The financials group edged up 0.2% on better-than-expected earnings from Sun Life Financial. Sun Life reported a 15% rise in quarterly earnings and raised its dividend. Its stock gained $1.34, or 2.7%, to $50.39.

The junior S&P/TSX Venture composite index advanced 12.76 points, or 0.40%, to end at 3,192.72.

The Canadian dollar closed up 0.14 of a cent at US93.74.

On Wall Street, U.S. stocks tumbled as worries about the deteriorating credit market resurfaced.

Yesterday’s relief rally was cut short when American Home Mortgage Investment Corp. said it may have to liquidate assets. Shares of the mortgage lender fell 90%.

The Dow Jones industrial average slid 146.32 points, or 1.10%, to 13,211.99. For the month, the Dow was down 1.5%.

The S&P 500 fell 18.64 points, or 1.26%, to 1,455.27. The Nasdaq Composite Index slumped 37.01 points, or 1.43%, to 2,546.27. For July, the Nasdaq was down 2.2%.