Gunfire and demonstrations erupted throughout Iran's capital tonight as thousands of people poured into the streets for the second consecutive night in a dramatic gesture of defiance to the shah and the military government.

The demonstrations followed a surge of violence Friday night in which troops opened fire on Iranians violating a curfew at the start of a Moslem holy period. The government said seven people were killed but other reports said 70 or more died.

There was no immediate indication of the number of casualties in tonight's renewal of the violence although there were unconfirmed reports of several deaths. Much of the shooting by the troops apparently was into the air, in an effort to drive people out of trouble spots and back into their homes.

Although there were reports of hostile crowds moving toward the embassy of the United States, long a major supporter of the shah, security officials there, reached by telephone late today, reported no trouble but said they could hear gunshots in the distance.

Much of Tehran was sporadically blacked out by power failures attributed to strikes and violence. A strike by maintenance workers shut down Iran Air and threatened to halt flights by other airlines.

The resurgence of violence, part of a broad campaign of opposiition that has presented Shah Mohammad Reza Phlavi with his most serious threat since he took the throne in 1941, coincides with the beginning of a 29-day Moslem mourning period.

Demonstrations began yesterday hours after Ayatollah Ruhollah Khomeini, 78, exiled leader of the Shiite Moslem opposition, sent a message to his followers from Paris, proclaiming that "torrents of blood will be spilled on Ashura" -- the tenth day of mourning on Dec. 11 when religious Moslems observe the death of Imam Hossein, the grandson of the prophet Mohammed, who was martyred in the 7th century.

Moslems plan to observe the traditional ceremonies of self-flogging despite a government ban. Khomeini called for a general strike and warned that "my followers are preparing themselves for confrontation.

They have told me they are preparing themselves and I have given my permission."

Khomeini's message took on an ominous tone and suggested that Moslems who die in any confrontation with government troops would be considered martyrs.

"People of Iran, sacrifice your blood to protect Islam and overthrow the tyrant and his parasites! Pay no taxes! The tree of oppression will be cut down! These are critical days for Islam: you will be remembered for your sacrifices," Khomeini said.

Khomeini said that he sought the overthrow of the shah by peaceful means, but said that other means would have to be used if this was not achieved.

In addition to Ashura, there are fears of escalating violence this Thursday, the commemoration of a bloody uprising in 1963 which led to the exile of Khomeini.

In an attempt to prevent new protests, the military government of Gen. Gholam Reza Azhari has banned all public religious processions during the 29-day period and has warned that all attempts to demonstrate would be put down mercilessly.

First indications of trouble tonight came from the southern bazaar area but quickly spread across the city.

"You could name any main street in the city and we have had reports of trouble from there," a U.S. security official said.

But there appears to have been more shouting and less shooting to-night than last night, when firing continued into the early hours of the morning.

Official reports this morning said seven died last night and 35 were wounded. But the death toll is believed to have been much higher.

Demonstrators in the bazaar this morning were chanting that 1,000 had died. Opposition sources, however, put no figure on the number of fatalities. The most ominous report was that 67 freshly dug graves had been seen in a cemetery in Tehran.

Last night's turmoil came at the start of the Moslem month of Moharram, a period for which trouble has been long predicted. The authorities today pinned the blame for the disturbances on the banned communist Tudeh party.

The bazaar area was again today the center of much trouble.

Demonstrators emerging from alleys chanted "Death to the shah!" and other antigovernment slogans, and then ducked for cover at the first sign of reaction from the solidiers. As more shots rang out, drivers abandoned their vehicles to take shelter in doorways.

On Shahreza Avenue in the center of Tehran, demonstrators halted a police car, ejected the driver and beat him severely and set the vehicle afire.

Wo Newsweek correspondents -- Loren Jenkins and Barry Came -- and a British journalist, Ken Clarke, were seized by troops and beaten at the Intercontinental Hotel, the site of one the disturbances. The three were detained by troops, but later were released. Their injuries reportedly were painful but not serious.

There were reports that as many as 20 persons were killed in the Moslem holy city of Qom, which was the scene of another major demonstration. Other deaths were reported in Isfahan and Tabriz.

Throughout Tehran most shops and offices remained closed.

Today's events had been preceded by threats of violence against foreigners.In one incident, a crod reportedly gathered outside the home of a U.S. Air Force sergeant shouting slogans such as "Go home white trash."

There were unconfirmed reports today of meetings between the shah and a number of political figures, including former prime minister Ali Amini but senior diplomats have played down rumors of plans for the formation of a civilian government in the immediate future. Well-placed sources suggested that there would be no efforts to dissolve military government during the next two months.