Canada's air traffic controllers union agreed early this morning to end its boycott of flights to and from the United States, following a second day of confusion that stopped most traffic across the north Atlantic and stranded passengers on both sides of the ocean.

The union pledged to begin restoring normal operations at 6:30 a.m. (EDT).

This morning's announcement followed more than five hours of negotiations in Ottawa between William Robertson, president of the Canadian Air Traffic Controllers Association, and Transport Minister Jean-Luc Pepin. They announced the accord at a joint news conference at 2 a.m. in the House of Commons building.

The agreement calls for creation of fact-finding teams composed of union and government representatives who are to begin an immediate investigation of union allegations that emergency traffic control measures in the United States have made U.S. airspace unsafe.

Yesterday, Canadian government lawyers appearing before the Supreme Court in Ottawa named approximately 100 controllers who they said had violated an injunction against job actions. Such offenses carry penalties of up as much as a year in jail and $5,000 fine. The court withheld a decision.

At the news conference, Pepin said the government plans to continue legal action against the controllers. The agreement included no provision for amnesty, he said.

Thousands of airline passengers were turned away from U.S. and European airports yesterday as Canadian controllers at Gander, Newfoundland, astride the major air route to Europe, disrupted transatlantic travel.

But prior to this morning's announcement, the Canadian government had announced that Gander controllers had agreed to resume handling transatlantic flights at 6:30 a.m. (EDT).

The Canadian government had reported earlier yesterday that some of its controllers at other facilities were defying the union's instructions to maintain the boycott. However, enough were standing firm so that only two of Canada's seven major air traffic centers were reported operating normally late yesterday.

British Airways said it canceled 12 of 20 flights to and from East Coast cities yesterday. Only four of TWA's 17 scheduled departures for Europe actually took off, generally with lengthy delays, a spokesman for that airline said. Many of its incoming flights were canceled, too.

Pan Am said that only one of its 15 incoming flights from Europe had been canceled, but delays were ranging from 25 minutes to nine hours. However, 12 of the carrier's 15 outgoing flights were canceled.

Air service between Canada and the United States also suffered serious disruptions. USAir canceled its 22 cross-border flights, spokesman Nancy Vaughan said. Other carriers reported less drastic cancellations, but serious delays.

Meanwhile, controllers in Spain and Portugal moved to join the boycott against U.S. aviation, while their counterparts in New Zealand and Australia reportedly called off plans announced earlier to launch their own boycotts.

The Canadian controllers alleged that the firing of 12,000 striking U.S. controllers and use of skeleton crews has made this country's airspace unsafe. Canadian government leaders countered that they are confident that U.S. skies meet acceptable standards of safety and appeared to see the action more as a sympathy strike.

Traffic between North America and Western Europe normally relies on the "Great Circle" route north over Newfoundland. Yesterday, most planes that did manage to get clearance for crossing used special routes passing south of Canadian-directed airspace. Shortages of controllers helped to limit traffic flow to about five flights each way per hour, or about 25 percent of normal levels, an FAA spokesman said.

The Canadian boycott, which began at 7 a.m. Monday on directions from the union, has created some of the worst confusion in U.S. aviation since 13,000 American controllers went on strike nine days ago. It also resulted in suspension of at least 29 Canadian controllers Monday.

Six controllers at the traffic center in Vancouver, meanwhile, were sent home for refusing to direct U.S. flights yesterday, said a spokesman for Transport Canada, the counterpart to the U.S. Transportation Department.

The spokesman said a few controllers at the Winnipeg and Edmonton centers continued to refuse to handle U.S. traffic. A truck ran over --apparently accidentally, the spokesman said -- communications lines serving Toronto's center and forced a cutback in its operations. Only the centers in Montreal and Moncton, New Brunswick, were reported operating normally.

Announcement of the agreement early today capped several hours of confusion about progress toward a settlement.

Transport Canada issued a statement in the afternoon that the Gander station alone would reopen to transatlantic flights at 7 last night.

But later in the day it reversed itself, saying the agreement had broken down. Mike Towner, a union official based at Gander, said by telephone that the morning shift at the center had been willing to handle U.S. traffic, but controllers on the afternoon shift had refused. Then came another decision to reopen.

About 100 controllers are assigned to the Gander station.

The strike by 13,000 U.S. controllers and the subsequent dismissal of 12,000 of them prompted reaction from counterpart unions around the world.

The departments of State and Transportation lobbied at Washington embassies and in foreign capitals yesterday in an attempt to pursuade foreign governments that the emergency traffic system is functioning safely and boycotts should not be tolerated.

Wire services reported that Spanish controllers had begun denying clearance to flights bound for the United States. In Portugal, whose controllers direct flights over much of the Atlantic from stations in the Azores, controllers said they would begin a boycott Saturday.

Similar actions planned by controllers in Australia and New Zealand were averted, at least for the time being. New Zealand controllers reached tentative agreement with their government to clear U.S.-bound traffic to intermediate points such as the Fiji Islands.

The Australian government threatened action against its controllers if they boycotted. The controllers decided to go to court.

In U.S. District Court here, Judge Harold H. Greene yesterday reduced to $750,000 a $4.75 million fine that the government had sought against the Professional Air Traffic Controllers Organizaton for violating an antistrike injunction obtained the day the walkout began.

The government began firing the 12,000 controllers after two days and declared the strike over. Greene ruled that if the strike was officially concluded, the union could not be fined for activity after that time. In addition, fines levied on PATCO President Robert E. Poli were reduced from $6,000 to $2,000.

Meanwhile, Amtrak has added extra cars to trains bound for its Montreal and Toronto -bound trains to help cope with a jump in increased ridership due to disruption of air traffic between the United States and Canada, railroad officials said Tuesday.

The Montrealer, an overnight train which runs between originating in Washington and Montreal via New York; New Haven, Conn.; and Springfield, Mass., was carrying is to carry four additional coaches and an extra sleeping car.