Western defense ministers promised yesterday to help the United States protect Western Europe's "vital interests" in the Middle East.

U.S. Secretary of Defense Caspar Weinberger and 13 of his North Atlantic Treaty Organization counterparts, after a two-day planning session, acknowledged in a declaration that situations outside NATO's boundaries may have serious implications for Western Europe's security.

"What they did," Weinberger told a news conference, "was to recognize that activities of certain nations outside the NATO area can vitally affect the interests of NATO and that nations should be prepared to participate fully in both consultations and to consider also the out-of-area deployment of forces."

"The recognition that this kind of activity may well be necessary, specifically anything involving the oil fields for example, would obviously involve the interests of Europe and the NATO nations very immediately," he added.

Under its 1949 charter, NATO is barred from using its allied command structure for activities outside Western Europe.

In their communique, the ministers said: "The past decade has seen an unrelenting buildup of Soviet military strength across the complete spectrum. This disturbing growth in military strength allows the Soviet Union to exert pressure in many parts of the world. . . ." As a result, the ministers added, they agreed to stick to a pledge made in 1978 to increase defense spending 3 percent a year, in real terms beyond inflation.