The Republican-controlled Senate salvaged President Reagan's proposed arms sale to Saudi Arabia yesterday as the required minimum of 34 senators voted to approve the politically controversial transaction.

With Vice President Bush presiding as a symbol of the importance attached by the administration to the showdown, Sen. William L. Armstrong (R-Colo.) cast the decisive 34th vote that deprived the sale's foes of the necessary two-thirds majority and sustained Reagan's veto of a congressional resolution disapproving the sale.

Armstrong joined seven other senators who switched after opposing the sale last month. They did so after a barrage of administration lobbying that portrayed the vote as a test of the president's leadership and credibility.

Along with the backing of four senators absent May 6 when the Senate voted to disapprove the sale, 73 to 22, the margin was just enough to allow the sale.

After the 66-to-34 vote, both sides claimed at least partial victory in the hard-fought battle.

Sen. Alan Cranston (D-Calif.), who led opponents, said Congress "has sent a strong, clear message to Saudi Arabia that friendship is a two-way street and that we expect much more of you."

He said continuing, strong congressional opposition to the sale reduced the arms package to less than 10 percent of the Saudis' original "wish list" of weapons.

However, Senate Foreign Relations Committee Chairman Richard G. Lugar (R-Ind.) said, "I'd call it a victory" for the administration. "The president has again established his ability to prevail in these close issues of foreign policy," he said.

But Lugar warned that the administration "will really have to do much better in the Middle East" to sustain support for moderate Arab countries.

"I think everybody understands that, including the president," Lugar said. "But without this victory, the chances of the president being effective would have been substantially diminished."

Lugar also contended that the vote was so close only because many senators feared election-year retaliation by Jewish voters and fund-raisers who oppose arms sales to Arab countries that have not made peace with Israel.

Senators facing reelection contests this year "had a lot of trouble voting for the president today," he said. "They apparently felt the vote would be interpreted by Jewish citizens in their states as an adverse vote. It's that simple."

Analysis of the vote appeared to support Lugar's contention. Of the 27 senators seeking reelection this year, only Majority Leader Robert J. Dole (Kan.) and fellow Republicans Jeremiah Denton (Ala.), Jake Garn (Utah) and Dan Quayle (Ind.) voted for the sale. Five of seven senators retiring this year supported it.

Despite the narrowest of margins, Reagan, who watched the dramatic roll call on television, seemed delighted. He telephoned Dole shortly after the vote and said, "You've got one happy man down here," according to a Dole aide.

Just before the vote, Dole told fellow Republicans they owe a debt to the Republican who occupies the White House.

"It is a test of the president's leadership," he said. "We are a majority party in large part because of Ronald Reagan's massive victory in 1980. He made us a majority; he made us committee chairmen."

The appeals to preserve Reagan's leadership and credibility as an important factor in Middle East diplomacy appeared critical in sustaining the veto.

"Today, we have the president of the United States, the leader of the free world, laying his national and international prestige on the line," said Sen. J. James Exon (D-Neb.), one of the eight who switched. "That makes this a considerably different proposition . . . . "

Sen. Pete V. Domenici (R-N.M.), another switcher, said, "I simply cannot say to Ronald Reagan that I oppose your design to bring peace to the Middle East and thus greater safety for Israel."

Armstrong said the key factor in his change of mind was the administration decision to remove from the arms package 800 Stinger missiles, shoulder-held weapons that Cranston and other critics described as "the terrorist's delight."

"I can't give you a very strong sales pitch" for the switch, Armstrong said, adding that "particularly in foreign policy, unless there is a strong case against the president, I'm inclined to give him the benefit of the doubt."

The administration pulled the Stingers from the package after the House also voted to disapprove the sale. That left only Sidewinder air-to-air and Harpoon antiship missiles in the package and reduced its value from $354 million to about $250 million.

The 356-to-62 House vote was so lopsided that the White House concluded that its only chance of salvaging the package was in the Senate.

Five Democrats joined 29 Republicans in voting to sustain Reagan's veto. In addition to Armstrong, Domenici and Exon, others who reversed themselves were Democrat Lloyd Bentsen (Tex.) and Republicans John P. East (N.C.), Chic Hecht (Nev.), Jesse Helms (N.C.) and William V. Roth Jr. (Del.).

Reagan picked up support from Gordon J. Humphrey (R-N.H.), Nancy Landon Kassebaum (R-Kan.), Russell B. Long (D-La.) and Ted Stevens (R-Alaska), absentees at the first vote. Among the absentees, only Paula Hawkins (R-Fla.), who faces reelection this year, voted against the sale yesterday.

Cranston said that, as the roll call began, he could count 66 votes against, one short of the number needed to override the veto, but was unsure of the votes of Armstrong, Humphrey, Long and Roth.

Lugar said Senate leaders had "a couple other standby" votes if needed, but Dole said he was not certain about those votes.