Turkish Prime Minister Bulent Ecevit signed a document yesterday affirming "principles of good neighborly and friendly cooperation" with the Soviet Union, but declared that the agreement will not alter Turkey's NATO commitments.

The political document signed by Ecevit and Soviet Premier Kosygin is similar to a 1972 communique issued from Ankara when then-Soviet President Nikolai Podgorny visited Turkish leaders.The Turks have been staunch Western allies since 1948, when Stalin sought Soviet bases alongthe strategic Turkish straits, which control Russian access to the Mediterranean. Since then successive Soviet governments have tried to improve their relations with the Turks. The 1972 communique and today's document have much less meaning than a treaty of friendship and cooperation such as the Kremlin has with Mozambique. Yesterday's pledge is similar to those signed in recent years by the Soviets with France and Norway, another NATO country.

Ecevit declared: "The whole document is proof and pledge that two neighboring countries have no aggressive intentions, respect their independence, territory, different regimes and way of life." He specifically denied that the Soviets had sought in any way to alter Turkey's commitment to NATO.

"During our relations and talks in Moscow, the Soviet leadership has acted out of the correct understanding we are both members of different alliances."

In the view of several observers here, Ecevit was trying to head off in these remarks any congressional backlash against his visit here and the improved tone of relations between Turkey and the Soviet Union.

Ecevit was recently in Washington pressing his case for an end to the embargo on U.S. arms shipments to Ankara imposed by Congress in 1975 for Turkey's invasion and occupation of nearly 40 percent of Cyprus the year before. Ecevit maintained he found "hopeful signs in U.S. congressional circles" that the arms embargo will soon be lifted, a key part of the Carter administration's emerging policy of reinvigorating NATO defenses because of intelligence estimates of vastly superior Soviet and Warsaw Pact forces in Europe. President Carter said last week that ending the embargo is the most importnant foreign policy matter facing Congress.

Ecevit refused to speculate whether he would seek military assistance from the Russians if the American embargo continues. He said that during his two days of talks with the Kremlin the Soviets "refrained from offering military supplies and we haven't asked for them."

In addition to the political document, the two countries signed an oil agreement under which the Soviets will ship three million tons of oil annually to Turkey in return for wheat and metals. If, at the end of the three years, the grain and raw materials haven't paid for the oil, the difference will be made up in hard currency. The deal allows Turkey, which is short of hard currency, to defer the cash cost of the oil.

Ecevit said Soviet oil would account for about 20 percent of Turkey's annual needs. Senior Western sources here said they do not regard the trade agreement as having any strategic factor in Turkey's ability to handle its NATO responsibilities.