Gunmen killed an Army General, a police officer and two Civil Guards in apparently coordinated leftist attacks in Madrid and Barcelona today, authorities said, in the worst outbreak of violence against the government since an attempted coup two months ago.

Police accused a shadowy, purportedly leftist terrorist group known as GRAPO of responsibility for the slayings, which brought the number of political killings in Spain this year to 22 and appeared to reopen another front in the violent guerrilla war against the fragile Spanish government.

Most of the killings this year have been by gunmen belonging to ETA, an extremist Basque nationalist faction, and authorities had thought that GRAPO, which was active in terrorism in the late 1970s, had been crushed by arrests of several of its leaders last year.

The killings today increased the political nervousness that has been at a high level since an attempted rightist military coup Feb. 23 and posed a new destabilizing threat to the government. Many Spaniards feared that today's violence could be used by rightists to goad the military into renewed plotting against the government in an effort to permit the armed forces to smash the left.

The issue of political terrorism was at the forefront of the Army grievances that led to the attempted coup, when rebels of the paramilitary Civil Guard seized the congress building and held the Cabinet and members of parliament hostage for 18 hours. The plotters, who included three senior generals awaiting trial, alleged that only a government headed by the military could contain political violence.

The general slain today was Andres Gonzalez de Suso, 62.He was a close associate of the reformist deputy prime minister responsible for security affairs, Gen. Manuel Gutierrez Mellado, who resigned from the Cabinet after the coup attempt.

Until recently Gonalez de Suso had acted as press spokesman at the Defense Ministry and he was considered representative of the loyalist democrats at the top of the military hierarchy. He was the fifth officer to be killed since the coup attempt. ETA claimed responsibility for the other four.

Gonalez de Suso was shot in the head as he left his home in Madrid's fashionable Salamanca district on his way to Army headquarters where he held a senior post in the artillery brigade. His two attackers were intercepted by a police patrol shortly after and in a gunbattle, a policeman was killed, three bystanders were wounded, one of them seriously, and one GRAPO member was injured and arrested.

The second suspect escapped into a subway and Madrid traffic was brought to a standstill as anti-terrorist squads scoured the city for him, raided apartments and mounted roadblocks at city exits while police helicopters hovered above downtown districts.

In the apparently coordinated Barcelona attack, shortly after the shootings in the capital, two men shot the Civil Guards in a bar at close range as they were having breakfast before going on duty. The killers escaped but police later said they were members of GRAPO.

Compounding the concern here was the apparent reappearance of the GRAPO faction on the terrorist scene. The organization, whose name stands for "Oct. 1 Antifascist Resistance Groups," the date that it killed four policemen in Madrid in 1975, had been dormant since last September when it claimed responsibility for shooting a general in Barcelona.

Police have claimed that they have infilatrated and broken GRAPO, several of whose alleged leaders were tried on terrorism charges recently in Madrid and sentenced to long prison terms. But leftist publications have charged that GRAPO has frequently acted to benefit the extreme right and has resurfaced repeatedly at crucial moments of Spain's democratic transition from dictatorship to democracy with destabilizing acts of political violence.

Concern has spread in political circles in recent days over several leaks to the news media of the secret evidence given by one of the main plotters of the February coup attempt to the investigating judge preparing the case. The leaks suggest a wider plot than the government has admitted and the evidence tendered by arrested Civil Guard Col. Antonio Tejero, who led the storming of congress, attempts to link King Juan Carlos to the plotting. Juan Carlos, who at the time expressed solid backing for the continuation of democracy, became the main factor in the failure of the coup.

Prime Minster Leopoldo Calvo-Sotelo, who took office shortly after the attempted coup, said today that the battle against terrorism would be a "long and hard one." Earlier he said that rumors of renewed plotting to bring about a second definitive coup were completely unfounded.

Calvo-Sotelo's apparent optimism was questioned by the Spanish Socialist leader, Felipe Gonalez, who said yesterday, "When I hear claims that everything is normal, I don't believe it and remain worried." Gonzalez, whose party forms the main opposition to the ruling party, said, "The risks [of a coup] have not disappeared."