STOCKHOLM, JAN. 12 -- Sweden and the Soviet Union said today they have resolved a 19-year dispute over commercial rights in the eastern Baltic Sea, and both called the accord a reflection of new thinking in Soviet foreign policy.

Prime Minister Ingvar Carlsson, who closed the bargain with visiting Soviet Premier Nikolai Ryzhkov, said the agreement ended a free-for-all in the Baltic that had hampered relations between the two nations.

The accord also satisfied Swedish generals who were worried that the Soviets could set up sea-based surveillance stations close to the Swedish coastline, Carlsson said.

The agreement gave Sweden 75 percent of its claim in the disputed zone and handed the Soviets one-fourth of their original demand.

Ryzhkov told Swedish businessmen the accord "shows that the Soviet Union wants good neighborly relations."

The dispute was over fishing and exploration rights in the Baltic, which separates the Swedish and Soviet mainlands by 200 miles.

The agreement did not affect the 12-nautical-mile zone of sovereign territorial limits of either country, but dealt only with commercial rights which normally fall within 200 nautical miles, or 230 statute miles, of a nation's coast. The Baltic is rich in salmon, cod and herring.

The accord opened the area to oil and mineral prospecting, which had concerned military strategists who feared that the Soviets could build oil platforms mounted with radar to peer into Swedish defenses.

The agreement was welcomed by Norway, which has a similar boundary dispute with the Soviet Union in the Barents Sea. Ryzhkov flies to Oslo Thursday.