East and West Germany agreed yesterday to build the first new highway link since World War II between isolated West Berlin and the rest of West Germany.

The package of accords signed in East Berlin is widely viewed as an important symbol not only of improved relations between the Germanys but between Bonn and Moscow. Tacit Soviet approval was needed for the new superhighway link to go ahead.

It is expected to provide an important shot in the arm for East Germany's ailing economy since West Germany will pay heavily and, officials say, happily for most of the construction work on this link providing further security for West Berlin.

The new autobahn, or superhighway, is to be completed in four years and will connect the bustling port city of Hamburg in northern West Germany with West Berlin, 135 miles away inside communist East Germany. In effect, these are the two biggest West Germany cities, although the East Germans and Soviets do not consider West Berlin to be part of West Germany but a special area under control of the four World War II allies.

THere are three other autobahns, all dating back 40 years or more, leading from West Germany into what is now the communist East. They eventually merge into two direct links with Berlin, further south in West Germany.

In the immediate postwar years, the roads to West Berlin were the scene of repeated traffic harassment and confrontation between the Western allies and the Soviets. But the four-power agreement on Berlin in 1971 guaranteed access on existing road links and the treaty the following year between the two Germanys normalizing relations provided the basis for further improvements.

Those relations have blown hot and cold. The new autobahn was proposed four years ago but it languished until about five months ago, when serious negotiations began. In May, Soviet President Leonid Brezhnev met in Bonn with Chancellor Helmut Schmidt and it is privately stated here that after those talks, the negotiations moved quickly.

Both Brezhnev and Schmidt have sought to portray their discussions as of considerable importance in bilateral relations, although at the time there was little obvious solid accomplishment.

West Germany remains a solid member of the Western alliance but improved relations with Moscow have given Schmidt Political and economic room to maneuver at home and abroad.

The agreements signed yesterday also involve the re-opening of a canal network running through West Berlin and into the East which had been shut since the war.

These joint projects, the largest since the 1972 treaty, reflect direct negotiations between the German states over issues relating to Berlin and the four-power agreement. The four powers - Britain, France, the United States and the Soviet Union - are kept informed.

Over the next 10 years or so, West Germany is to pay East Germany about 3.5 billion under the new agreements. About 640 million of this is for construction of a 75-mile stretch of the new Autobahn inside East Germany, which will connect with another East German autobahn. East Germany will contribute about 100 million and do the construction work.

The new autobahn and reopened canals could have important impact on keeping industry alive in West Berlin. The highway should cut trucking time in half between Hamburg and West Berlin and speed commercial traffic from the busy port to other East European countries.

Bonn also agreed to raises in the fees to maintain the autobahns over the next 10 years to a total of about $2.8 billion. The rest is to pay for reopening of the Teltow Canal.

The expanded Berlin waterway system, which hooks up to the Elbe and Oder rivers, will avoid a lengthy detour barges must now make to get to West Berlin docks.

Some opposition politicians here have charged Bonn with paying too much for the new agreements but West Berlin Mayor Dietrich Stobbe said the pact's advantages exceed what the optimists could have predicted 10 years ago.

The chief West German negotiator, Guenter Gaus, said the agreements were an important factor in stabilizing relations between the two countries, aside from improving access to West Berlin. The conditions for future agreements, he said, will be "sensibility, the will to compromise and patience."

East Germany's negotiator, Deputy Foreign Minister Kurt Nier, described the agreements as of considerable political significance and as a contribution to East-West detents.