Spain broke relations with Guatemala today following what it called the "brutal assault" by Guatemalan police in the Spanish Embassy here yesterday that left 39 dead.

The deaths apparently were caused by a fire that began when one of a group of peasants who had occupied the building threw a gasoline bomb at police storming the embassy.

But statements by Spanish Ambassador Maximo Cajal y Lopez, one of two survivors of the blaze that took the lives of the rest of his staff, left little doubt today that Spain holds Gutemala's military government responsible.

According to the Spanish statement, Cajal had pleaded with police surrounding the building to go away and allow him and the peasants to leave the embassy peacefully. Instead, police attacked the building and the bomb apparently was thrown as they broke down the door to the ambassador's office.

Spain officially has demanded an investigation of the assault on its embassy.

Most of the 30 Guatemalan peasants who died in the fire were part of a group of Indians who traveled here nearly a month ago from their homes in northern Quiche Province to ask that the military government stop its army from "terrorizing" them.

Government officials refused to meet with them, they said, and the local office of the Organization of American States was not interested. When they briefly occupied two local radio stations to plead their case last week, the government publicly branded them as terrorists.

Yesterday, the peasants went to the Spanish ambassador, hoping for support and determined to occupy the embassy until someone paid attention to their request that an independent commission be appointed to investigate their charges of murders and disappearances at the hands of military officials who wanted their land.

Shortly after their arrival at the embassy, it was surrounded by an estimated 400 Guatemalan police. The Spanish government said Cajal then telephoned the foreign and interior ministers, and the chief of police, to get them to call off their forces, but none would answer. Cajal and two former high-ranking Guatemalan officials who happened to be inside, the Spanish said, shouted to the police commander that the police should go away.

Instead, the police stormed the embassy, according to the Spanish government, breaking down the doors and the roof and finally the door of the ambassador's office, were both occupiers and hostages had hidden in fear.

"in this instant," an official Spanish statement issued today said, "one of the occupiers threw a gasoline bomb" and the room was ablaze. At least 39 persons died, including the embassy staff, the former Guatemalan officials, and all but one of the peasants. Cajal escaped by jumping out a window.

In its statement breaking diplomatic relations with Guatemala, Spain expressed its "firm condemenation of the conduct of Guatemalan authorities who, violating the most elemental rules of international law . . . permitted their security forces to brutally attack the Spanish Embassy."

In an emotional statement after his escape, Cajal called the Guatemalan police "brutes" and "beasts," and strenuously denied a Guatemalan claim that the local authorities had been called in by embassy officials.

At a press conference last night, a spokesman for Guatemalan President Romeo Lucas Garcia placed full blame for the tradegy on the peasants and their supporters who occupied the embassy yesterday morning.

Spokesman Carlos Toledo Vielman called the incident a "terrorist massacre" perpetrated by "extremist clanestine terrorist factions which have sown pain and death among the peaceful people of Guatemala."

The Associated Press reported from Guatemala City that about 15 heavily armed men today stormed a hospital where the one peasant survivor was being treated, and carried him away.

[In Washington, the State Department, commenting on the assault on the Spanish Embassy, said it was "shocked" by this tragic incident, which is especially deplorable because it could and should have been avoided."]

[Noting that "diplomatic missions must be respected" and "should not be used by demonstrators, whatever their cause," a department statement said neither "should they be entered by local authorities unless requested by the diplomatic mission concerned."]

In an interview last week, apparently before they had decided to occupy the embassy, members of the peasant group appeared to be simple farmers. They preferred speaking their native Ixil language to Spanish.

"Our people are afraid to sleep in their homes," one young woman said "Every night the soldiers are kidnapping our people and stealing from us. So we have come here, without food, without clothing to find protection."

She said her husband had been killed by soldiers several weeks eariler.

Some of the peasants said they recently had been herded into the main square of Chajul to watch an Army truck dump out four bodies, apparently of farm workers kidnapped in the nearby town of Uspantan several days earlier. o

The Quiche region has been the scene of clashes between military patrols and the growing Guerrilla Army of the Poor (EGP). According to priests working in the area the fundamental cause of the recent upsurge in repression is the desire of large landowners in the area to reclaim land distributed to peasants in the 1950s.

The Catholic Church in Guatemala has also charged persecution of its officials. Following a statement by Central American Jesuits in early January condeming repression of peasants, the government began a media campaign accusing the preists of fomenting revolution. Two weeks ago the so-called Secret Anti-Communist Army, a rightist paramilitary group, threatened to kill all Jesuit priests in the country.