GENOA, Italy (AP) _ A huge explosion rocked a burning tanker today, spreading flames over the sea and hampering efforts to avoid an ecological calamity on the Italian Riviera. It was the second blast aboard the ship in three days.

Authorities said a second tanker, set afire in an earlier accident about 85 miles to the southeast, also was threatening to break up and spill its cargo.

Thousands of residents and tourists lined the beaches west of Genoa to watch a towering wall of smoke billowing today from the Cypriot-registered Haven, which lay about 2 miles off Genoa with its bow down and propellers out of the water.

''Let's hope it's sinking slowly and that the ship does not crack. That would make much easier anti-pollution efforts,'' said Adm. Antonio Alati, chief of the Genoa port authority.

The ship was crippled by an explosion Thursday that killed two sailors and left three missing. A third sailor died of his injuries Friday, authorities said.

Anti-pollution teams and boats trying to save the Haven and its cargo of nearly 41 million gallons of oil had to temporarily suspend their activities, but returned to pump water on the burning vessel and lay more floating barriers to try to contain spilled oil.

Port authorities said British anti-pollution experts had joined Italian teams today and American spill experts had been summoned.

Meanwhile, the burning tanker Agip Abruzzo was in danger of beaking up and spilling its cargo of 23.5 million gallons of oil off Leghorn, 85 miles to the southeast, port officials said.

The tanker was rammed Wednesday night by the ferry Moby Prince, setting off a fire that killed all 72 passengers on the ferry and 67 of its 68 crew members. The crew of the tanker escaped unharmed, but Leghorn officials said today the burning Italian tanker was now in danger of breaking up and spilling its cargo.

Corrado Clini, director general of the Environmental Ministry, said Friday he was concerned the Haven's cargo might cause the Mediterranean's worst oil spill.

A spill could ruin resort beaches of the Italian Riviera on either side of Genoa and threaten the French Riviera 90 miles to the west.

The sandy beaches immediately threatened by pollution included those of Arenzano, Pegli, Voltri and Cogoleto, between Genoa and Varazze.

Authorities said it was unclear how much oil had leaked from either the Haven or the Agip Abruzzo. An official of the Environmental Ministry estimated Friday that about 5.8 million gallons possibly had burned on the Haven.

The Haven's load was almost four times the oil spilled by the supertanker Exxon Valdez in Alaska's Prince William Sound in 1989 and nearly two-thirds the amount spilled when the Amoco Cadiz ran aground off the France in 1978.

The Italian daily Corriere della Sera warned that oil from a big spill could float as far as the French Riviera, depending on the currents.

Clini said the explosion on the Haven occurred as the crew cleaned a tank that had been unloaded of about 23 million gallons of oil. He speculated a spark of some kind ignited pockets of gas.

Twenty-nine crew members who jumped overboard were hospitalized suffering from burns and smoke inhalation. Eleven were reported in critical condition.

In Brussels, the European Commission said today it would give $615,000 as urgent aid to the victims of the Haven explosion. On Friday, it granted $1.23 million in emergency aid to families of the 142 people killed in the ferry accident.