Nicaragua today called invocation of the Inter-American mutual defense treaty following what it said was an invasion by 300 guerrillas and mercenaries across the border from Costa Rica.

The 1947 pact, also called the Rio Treaty, is implemented through the Organization of American States. It provides for a number of alternative measures, including use of peacekeeping troops or pacification forces from OAS member nations.

Foreign Minister Julio Quintana called the situation "extremely grave." He said he has instructed Ambassador Guillermo Sevilla Sacasa in Washington to call for a metting of the OAS permanent council, which will then decide whether to hold a consultative session on if and how to invoke the treaty.

Quintana said the guerrillas, traveling in groups of 60, crossed the border on foot and attacked at five separate points in southern Nicaragua early this morning.

He said the guerrillas, firing mortars from Costa Rican territory across a small bay, also attacked a Nicaraguan Coast Guard patrol boat in the Pacific at La Bahia de Salie forces, which he said he presumed were mostly Nicaraguans of the Sandinista National Liberation Front, included mercenaries from Panama, Costa Rica and possibly some Spaniards.

According to the government and opposition sources, heavy fighting between the invaders and National Guard troops was taking place in Rivas, a regional capital close to the Costa Rican border. Phone communication and access to the area were cut this morning.

Quintana said the guerrilla attack included the killing of a National Guard captain and the temporary kidnaping this morning of two Ecuadorean diplomats who are part of an OAS team of border observers sent there last fall after mutual Costa Rican and Nicaraguan invasion charges.

According to Quintana, the two, Eduardo Colon Martinex and Osvaldo Vallejos, were known to have been driving to Managua from the southern border, but their empty car was found by National Guard patrols. Although he said he had no more details, the foreign minister said the two were released by midafternoon.

The Nicaraguan government also charged that two aircraft, a DC3 and a DC6, one camouflaged and the other bearing unknown insignia including a red star, were seen yesterday in the northeast corner of the country near the town of Siuna.

The Sandinistas are not known to control any planes. Reports that the aircraft contained guerrillas supporting ground forces attempting to take over two large mines in the area were unconfirmed.

This morning's attacks occured on a narrow strip of land between the Pacific Ocean and Lake Nicaragua, a large body of water reaching almost to the Costa Rican border. It has been the site of numerous Sandinista attacks, allegedly launched from camps within Costa Rican territory, over the past nine months.

Guerrilla attempts to capture a portion of territory contiguous with the border and establish a "liberated zone" have repeatedly failed in the past. The area around Rivas, and particularly in the small border town of Penas Blancas, has been the scene of nearly continuous fighting.

Sandinista leaders announced months ago they were preparing to launch a massive offensive to continue the popular insurrection begun here last September against the government of President Anastasio Somoza. Although Quintana said today's attacks "could result in civil war," much of the country has been in a state of sporadic war for months now.

Last week, the guerrillas abandoned the north-central town of jinotega, where government troops claimed 200 Sandinista dead in three days of fighting.

In an interview broadcast yesterday on Costa Rican television, Tomas Borges, one of a nine-member Sandinista council of directors, said,"The offensive has begun." He vowed it would "soon spread to nationwide in surrection" to overthrow Somoza. Borges has been considered one jof the doctrinaire Marxists within the pluralistic Sandinista leadership. Yesterday however, he pledged that the Sandinistas "do not propose a socialistic scenario, but rather a democratic one" with early elections.

Quintana said Nicaragua felt additionally justified in invoking the Rio Treaty following a statement yesterday by Venezuelan President Luis Herrera Campins saying a break in relations with the Somoza government would be a failure.

Mexican President Jose Lopez Portillo severed relations with Nicaragua last week on grounds of "horrendous genocide" by the government and called on other Latin American nations to do the same.