Salvadoran rebel leaders and a government delegation headed by President Jose Napoleon Duarte held 5 1/2 hours of talks here today in their first face-to-face meeting since El Salvador's civil war began five years ago.

After the two delegations left the small town's church where the talks were held, San Salvador Archbishop Arturo Rivera y Damas read a joint communique in which the two sides agreed to establish a nine-member commission to carry on the dialogue begun today. The government and the rebel alliance are each to name four representatives, while a Salvadoran bishop will be named as moderator for their talks.

The commission's specified task, to begin in a second round of talks sometime during the last half of November, will be to study proposals to try to achieve peace "in the least time possible." At the same time, the commission will try "to facilitate the humanization of the armed conflict" that has taken tens of thousands of lives.

The leaders of both delegations were enthusiastic in public statements made on the porch of the church after the talks, although both emphasized that today's closed-door meeting was only the beginning of what could be a lengthy process.

"We're not offering miracles, but we're struggling so that the Salvadoran people can achieve the miracle of their own liberation," Duarte told a rain-drenched crowd of several thousand that filled the small main square of La Palma.

"The results, in our opinion, were positive," rebel political leader Guillermo Ungo said.

When guerrilla leader Ferman Cienfuegos appeared before the crowd he held up his hand and said, "We want peace." The crowd immediately picked up the slogan and chanted: "We want peace; we want peace."

Cienfuegos then said: "We're going to achieve peace, with reforms, peace with democracy and pluralism." This appeared, in part, to be a gesture to Duarte's insistence that any peace talks should lead to the incorporation of the guerrilla movement into the democratic political process.

Cienfuegos heads one of the smaller of the five guerrilla groups that make up the Farabundo Marti National Liberation Front, the military wing of the rebel coalition. His group is considered the most flexible politically.

But he spoke in the name of all the groups, standing next to Facundo Guardado, who leads the Popular Liberation Forces, reportedly the most hard-line faction of the guerrilla movement.

Ungo, speaking publicly in El Salvador for the first time in more than four years, drew an enthusiastic response from some parts of the crowd. His comments on the church steps were greeted with chants of "Ungo, Ungo," as youths raised their hands and flashed a V-for-victory sign.

The applause for Duarte after his comments, appeared slightly louder.

Despite strong security concerns on both sides, the meeting occurred without violent incident. The crowd was composed of local people, curious outsiders and many government employes trucked here at government expense. Many waved white flags reading "Peace and Democracy."

No weapons were seen, in compliance with Duarte's condition that he would not talk to the rebels "with weapons on the table." Boy Scouts and 80 Red Cross workers erected rope barriers or linked arms to keep back the crowd and restrain television crews and news photographers.

Just after the talks began at 10:15 a.m. local time, government workers outside distributed a seven-page position paper that Duarte was handing to the rebels inside the meeting. It offered a broad security guarantee so the leftists could safely participate in politics and future elections.

Duarte promised to ask the national Legislative Assembly to approve an "immediate and unrestricted" general amnesty for anyone guilty of political violence, presumably including both the guerrillas and the armed forces. He said it was "indispensable" for Salvadorans to stop using violence to seek power.

As he had when he proposed today's talks a week ago before the U.N. General Assembly, Duarte said the reality of El Salvador today was not what it was in 1979, when the rebels took to the hills. He insisted that democracy had made great advances since then and that it could provide a framework for all Salvadorans to work out their differences peacefully.

Joining Duarte in the talks, according to Christian Democratic officials, were Defense Minister Carlos Eugenio Vides Casanova, top Duarte adviser Julio Rey Prendes and Rene Fortin Magana, head of the small Democratic Action Party allied in the government with Duarte's Christian Democrats, as well as Abraham Rodriguez, another Duarte adviser. Two church officials, one of them Rivera y Damas, sat in on the talks.

In addition to Cienfuegos and Guardado for the guerrillas, Ungo was joined in the talks by Ruben Zamora. Ungo and Zamora are leaders of the Democratic Revolutionary Front, the rebel coalition's political arm. Both leftist politicians had arrived in El Salvador yesterday, flying in from Ungo's home in Panama on a Colombian Air Force jet.

Guerrilla leader Joaquin Villalobos, head of the powerful People's Revolutionary Army guerrilla group and considered by many to be the most influential rebel commander, did not show up as planned because of a dispute between the two sides over providing him a helicopter to travel here.

Noting that Duarte had left only a week to prepare for the talks, Zamora said that "it was impossible for Commander Villalobos to walk to the site from where he is."

Just before the beginning of the talks Duarte confirmed that the Red Cross had asked his government to provide a helicopter to fly Villalobos to the talks from his rebel base near the Torola River in eastern El Salvador. Since the base is more than six days' torturous march from here, a helicopter was the only way he could have made it to the talks. Duarte said that no civilian helicopters were available -- although one frequently circled the town today -- and that a military helicopter would not have been appropriate.

Leaders on both sides said today that the fact they were meeting today was an important first step toward a possible peace despite their mutual suspicions. Duarte arrived here more than two hours early for the meeting in a mile-long motorcade, and stopped outside La Palma to walk about a mile into the town. He told reporters before the meeting: "I think by just sitting down, that is the first stage: by just making the whole country aware that dialogue is not bad. Just being here is an advance."

"I feel very emotional," he added, "I've been thinking of this for years."

The rebel leaders drove south down a steep, rutted mountain road into La Palma from guerrilla-held territory this morning, arriving just a few minutes before the talks began. They traveled in two Red Cross jeeps, and were met by a third Red Cross vehicle outside La Palma for the entry into the town.

Despite the officially expressed optimism, there were sobering reminders of the lingering political realities of the country offered today by both the Army, politically to Duarte's right, and the guerrillas to his left.

Defense Minister Vides Casanova told reporters before the talks: "If the subversives were within the framework of the law, we could get together. But they are outside the law. We believe our obligation is to bring order to the country."

Vides Casanova, wearing a camouflage uniform without markings of rank, said the armed forces' "only concern" is that "all action to seek peace stay within the boundaries of the constitution." In Salvadoran political language, that meant that Duarte should not cede political power to the guerrillas through negotiations but encourage them to seek it through elections.

Vides Casanova acknowledged that "the constitution doesn't exactly bar us from negotiations," and said he was participating today in "a talk, not a negotiation."

"The position of the Army regarding the negotiations has not yet been defined. Until now no one has asked us to come to either negotiations or a dialogue. But perhaps in the future we will be asked and then we will . . . respond to circumstances and conditions at the time," Vides Casanova said.

Bearded, unarmed guerrillas who came out of the hills and into the town this morning with their leaders passed out leaflets to the crowd proposing six steps "to open the way to a true dialogue and negotiation." These included an immediate halt to military operations against civilians, freedom for "all captured persons," trial of war criminals and a general salary increase.

The leaflets, signed by the guerrilla coalition, denounced recent government operations in the surrounding province and referred to the Army as the "murderous and cowardly troops of Duarte."

Juan O. Tamayo of Knight-Ridder Newspapers reported the following from La Palma:

The unarmed guerrillas came in from one street, hard-faced youths wearing blue jeans and combat boots.

The progovernment people came in from another, many of them ill-dressed refugees bused and trucked from large cities where they had seldom seen rebels.

They sang together. They sipped from the same soft-drink bottles. They shared shade from the hot tropical sun of the northern Salvadoran mountains.

The guerrillas told war stories, stories of their fight for "the people," of their battle against what they called an unjust and repressive system.

The refugees told of their poverty, their hunger, their fear of returning to towns now swallowed by civil war.

Just a few feet away, inside the modernistic Sweet Name of Mary Church set incongruously in the middle of this rustic old town, President Duarte and four rebel leaders talked of peace.

Outside, in the dusty plaza to the front and the cobblestone streets to the side, the 3,000 persons who witnessed the encounter already had worked out their own peace, even if only for a day, in just one little piece of El Salvador.

Knots of people erupted into enthusiastic applause as about 90 members of the masas -- organized peasants who live in areas controlled by the guerrillas -- marched silently down the narrow street behind the church.

Maybe the onlookers didn't agree with the placards -- "If Duarte wants peace, stop the bombing," said one; "Stop Reagan intervention," read another.

But they certainly agreed with the words from the chunky young woman wearing combat boots and a blue dress who led the scruffy-looking group to an empty lot guarded by representatives of the International Committee of the Red Cross:

"I love my country, and I am very happy to be here among you," she said with a beaming smile that drew applause and shouts of "Viva El Salvador!" from her listeners, and even some tears from elderly women.

One woman watching the odd-looking group asked, "Are they guerrillas?"

"No," answered a peasant next to her. "Just poor Salvadorans like us. Just peasants."