President Reagan talked tough on El Salvador today, saying that the defeat of the U.S.-backed regime there by leftist guerrillas would threaten the entire Western Hemisphere and the security of the United States.

"We believe that the government of El Salvador is on the front line of the battle that is really aimed at the very heart of the Western Hemisphere, and eventually at us," Reagan said. His remarks, delivered with emotion at a meeting of the Commonwealth Club here, were greeted by applause.

Reagan was answering a sharply worded written question that suggested the escalation of U.S. military aid to El Salvador appeared to be the "beginning of a replay of the early days of Vietnam," and asked Reagan for assurances that this was not the case.

Reagan gave an assurance that U.S. combat troops would not be used in El Salvador. But he said the United States "may want to go beyond" the present level of 55 military advisers who are training Salvadoran troops.

After saying "there is no parallel whatsoever with Vietnam," Reagan proceeded to tick off his domino theory of what would happen if El Salvador falls to guerrillas, whom he described as trained by Cuba "and others of the Iron Curtain countries" and supplied with weapons coming through Nicaragua.

"The threat is more to the entire Western Hemisphere and toward the area than it is to any one country," Reagan said. "If they get a foothold, with Nicaragua already there, and El Salvador should fall as a result of this armed violence on the part of the guerrillas, I think Costa Rica, Honduras, Panama, all of these would follow . . . . Fifty percent of everything that we have to import comes from the Caribbean, through the Panama Canal."

Reagan made much of what he sees as a democratic trend in El Salvador, saying that the government there is "considering calling a new election, hopefully before the year is out."

This was indirect confirmation of reports earlier in the week that the Salvador regime would speed up presidential elections that had been scheduled for next March. Sources said today that the new election date will be Dec. 15. Reagan did not mention a specific date, nor did he say the speedup was the result of recent negotiations between U.S. and Salvadoran officials.

However, he cited elections in El Salvador as evidence that the regime was committed to democracy. He repeated once again an account of how voters in the election last March withstood threats and violence to cast their ballots.

Administration officials said today that they hope new elections would help convince Congress to approve Reagan's request for $60 million more in military aid for the Salvadoran regime. Administration officials lobbied Congress vigorously this week, arguing that Salvadoran troops' ammunition supply could run out within 30 to 40 days unless the United States provides more aid.

A major sticking point with Congress is the administration's desire to increase the number of U.S. advisers in El Salvador and possibly permit some of them to accompany Salvadoran troops into hostile areas.

White House spokesman Larry Speakes approached Reagan during a short briefing before his speech here and asked about the advisers. Speakes returned to tell reporters that Reagan had made no decision about whether more advisers should be sent.

But Reagan, responding later to the question, went beyond this. He observed that there are 45 U.S. advisers in El Salvador, 10 fewer than a limit the president described as "self-imposed."

"We may want to go beyond that 55," Reagan said. "But in no sense are we speaking of participation in combat by American forces."

Reagan met this afternoon with Secretary of State George P. Schultz and Secretary of Defense Casper W. Weinberger to discuss issues including El Salvador. White House officials said it was not a meeting to make decisions, and no statement was made to reporters.

Administration officials acknowledged that the president has a fight on his hands next week over the $60 million military aid request.

Sen. John Glenn (D-Ohio), a prospective Democratic presidential candidate, today was quoted by the Associated Press as saying the amount of aid requested was "out of proportion with our interest and objectives" and should not be given to El Salvador unless human rights violations are reduced.