The Senate yesterday voted to require President Reagan to certify, twice a year, that El Salvador's ruling junta is making progress on human rights and political reform before it can continue to receive U.S. aid.

Both the Reagan administration and junta President Jose Napoleon Duarte oppose the conditions, and lobbied strenuously against them.

The vote, 54 to 42, was the first test on the Senate floor over the emotional issue. It came on a preliminary amendment to a $5.8 billion foreign aid bill, and thus was not conclusive. Additional votes on the issue are scheduled for this morning.

The bill includes $25 million in military and $40 million in economic assistance for the war-torn Central American nation during fiscal 1982. As now written and approved by the Senate Foreign Relations Committee, the bill would require Reagan to certify that the regime was committed to free elections, was moving to "end indiscriminate torture and murder of citizens by the armed forces," was making "continued progress in economic and political reform" and was making a good-faith effort to investigate the murder of six U.S. citizens there last winter.

The House has yet to act.

In a letter read on the Senate floor, Duarte said he agreed with the rationale behind the conditions, but "The government and the people of El Salvador would consider legislative conditions unwarranted. I hope that the Senate will recognize the conditions as an unacceptable imposition to a government friendly to the United States."

Yesterday was the first time the administration's El Salvador policy has been debated on the Senate floor. Sen. Christopher J. Dodd (D-Conn.), chief author of the conditions, said the vote represented at least a temporary defeat for the administration, but he conceded that it was difficult to predict what will happen when the Senate resumes debate on the issue.

Sen. Richard G. Lugar (R-Ind.) argued that the conditions were so tightly drawn that they made "certification virtually impossible" and would result in ending all aid to El Salvador.

Sen. Jesse Helms (R-N.C.), another opponent of the conditions, said they would "play into the hands of people who are no friends of the U.S. . . . We better help our friends now or we won't have any friends to help."

Dodd and others argued that the conditions were drawn up in response to widespread violence committed by the ruling junta against the citizens of El Salvador, and that they would give Duarte a tool to use in controlling his armed forces.

The military assistance bill calls for spending $5.8 billion in military and economic aid, $900,000 less than Reagan requested. In a letter to Sen. Charles H. Percy (R-Ill.), Reagan said yesterday that any cuts in the program "would have serious repercussions on our foreign policy and would endanger our national security objectives."

The Senate yesterday also approved an amendment designed to help Costa Rica with its balance of payments problems. It would raise assistance to that nation to a total of $15 million.

Rep. Henry A. Waxman (D-Calif.), chairman of the House health and environment subcommittee, said yesterday that an unpublished study by the Environmental Protection Agency showed that auto emissions standards should not be relaxed.

Waxman charged that administration officials had revised the study by imposing over-optimistic assumptions on it to justify a request to loosen the emissions standards.

Rep. Fortney H. (Pete) Stark Jr. (D-Calif.) has given up chairmanship of the House subcommittee dealing with public assistance and unemployment compensation to take over the Ways and Means Committee's panel on select revenue measures.

This puts Stark in charge of drafting the special tax provisions that attract so much attention from special-interest groups and their lobbyists. The chairmanship became vacant with the death of the former chairman, William R. Cotter (D-Conn.). The new chairman of the subcommittee on public assistance and unemployment compensation is Rep. Harold E. Ford (D-Tenn.).