In a day of rage they called an answer to President Reagan's "declaration of war," guerrillas yesterday stormed this major border crossing into Honduras, overran the nearby city of Santa Rosa de Lima and blew up at least five bridges.

Honduran troops used mortars and machine-gun fire from across the Goascoran River to cover the retreat of Salvadoran troops caught here, according to residents' accounts to reporters who arrived today, but they could not stop a team of rebel sappers from blasting a major section of the steel and concrete span that links the countries.

Military analysts said the fighting in La Union province was an indication of major guerrilla strength where little had been reported before.

This was also the first time a border post on a main highway, in plain view of the Honduran units stationed across the river, has been attacked. Other border crossings, such as Sabanetas in guerrilla-controlled northern Morazan province and Citala in rebel-dominated Chalatenago, have been left largely untouched.

The analysts said that Salvadoran military intelligence had been aware that an attack was imminent on Santa Rose de Lima, which like El Amatillo straddles the key Pan American Highway. But no effective countermeasures were taken to prevent it, they said.

"There was a government Army sweep through that area just last week," one analyst said yesterday. "What did they do?"

The cost in lives--civilians, government soldiers and guerrillas--was high in terms of this war's battles.

Eight of the 50 Salvadoran soldiers and police at this post were killed after being awakened by the blast of guerrilla gunfire and the shouts of rebels demanding their surrender at about 1 a.m. yesterday, according to local officials. Seven were taken prisoner and forced to carry captured ammunition, other survivors said.

At least one of more than a dozen drivers who had been sleeping in parked tractor-trailers was killed when one truck was hit and exploded into flames. He had taken refuge under it during the fighting.

Later, the guerrillas torched another 12 trucks, the hulk of which still smoldered at midday.

A single artillery round--it was not clear to residents who fired it--killed 10 civilians, including five children, hiding in one of the little general stores of the tile-roofed settlement below the border post. Pools of blood covered the floor, and red handprints showed the dying clung to furniture in an effort to stand.

"It was the last bomb," said Maria Flores de Umanzor, a relative of some of the dead. It was fired sometime after the rebels had pulled back into the steep, arid hills at about 6 p.m., Umanzor said.

The guerrillas left at least three dead. By the time reporters arrived shortly after noon, the two bodies nearest the customs office had been drenched in gasoline by someone--no one who was asked seemed certain who--and set afire.

In Santa Rosa de Lima--one of the largest towns the guerrillas have ever taken, with an urban population of about 7,000 and a municipal jurisdiction of more than 29,000 inhabitants--the fighting was also intense.

U.S. reporters who made contact with the guerrillas in the town yesterday said there were about 110 regular rebel troops and another 40 members of demolition teams brought in from Sanvicenta province in central El Salvador.

Fighting went on there for at least 16 hours as the rebels concentrated on taking the separate National Guard and national police command posts. This morning the bodies of seven government dead were seen taken away in a helicopter. Five guardsmen were reported by townspeople to have been captured when their barracks fell in the early afternoon yesterday.

The national police fared better, holding their garrison on the outskirts of town until the rebels finally left at about 5 p.m. after at least 16 hours of combat. The putrifying bodies of four guerrillas were in the streets of Santa Rosa de Lima as residents set about repairing damage and restoring some sense of peace. A local man described as the "village idiot" also lay dead on one of the city's dirt streets, apparently killed in the crossfire.

In some guerrilla attacks on urban centers the rebels have been careful to pay residents for whatever supplies they took. In Santa Rosa de Lima, people complain that the rebels not only had blown up the main bank but also had looted one small jewelry store of all its gold and watches and had stolen boots and trousers from at least two clothing shops.

One house was burned by the rebels who told its owner he was accused of working for the national police. He denied any such connections as he talked to reporters today in front of his small home's smoking ruins.

The stretch of the Pan American Highway was swarming with government troops by late this afternoon. One convoy of at least six troop transports carried soldiers to the scene of yesterday's action, but by the time they arrived no one had seen or heard from any living guerrillas for at least 20 hours.