The Centers for Disease Control and Prevention on Friday reversed a controversial recommendation suggesting people who have had close contact with a person infected with the coronavirus do not need to get tested if they have no symptoms.

The change comes after widespread criticism of the earlier guideline, as well as reporting from The New York Times that the recommendation came from political appointees in the Trump administration and skipped the agency’s usual rigorous scientific review.

The previous phrasing, which suggested asymptomatic people who have had close contact with an infected individual “do not necessarily need a test,” now clearly instructs them: “You need a test.”

Public health experts welcomed the change as consistent with research showing that people without symptoms can spread the virus to others.

“It’s good to see science and evidence taking a front seat for a change,” said Scott Becker, chief executive of the Association of Public Health Laboratories. “It has been a wild few weeks.”

Dr. Ashish Jha, dean of the School of Public Health at Brown University, said, “I’m thrilled to see it, it clearly needed to be done.” But he worried the damage to the agency’s credibility would be long-lasting.

The original guidance, posted on Aug. 24, drew sharp criticism even from the C.D.C.’s partners, including the Infectious Diseases Society of America, which urged its members to continue testing people without symptoms.

Updated

In a statement on Friday, Dr. Thomas File, the organization’s president, said, “The return to a science-based based approach to testing guidance from the Centers for Disease Control and Prevention is good news for public health.”

Several studies have shown that people can efficiently spread the virus even if they don’t have symptoms. Some research has suggested that they are actually most likely to transmit to others starting around a day before the onset of symptoms, when the viral load can be the highest.

“We know that asymptomatic transmission is what’s driving this pandemic, and we know that we cannot rein in Covid-19 unless we have widespread accessible testing,” said Dr. Leana Wen, a former assistant health commissioner for Baltimore.

“We should be encouraging far more people to get tested and not less,” she said. “Their previous guidance on this made no sense.”

After the initial pushback from the scientific community, the director of the C.D.C., Dr. Robert Redfield, sought last month to clarify the agency’s position, saying testing “may be considered” for people without symptoms.

The new recommendation was a “detailed follow-up to Dr. Redfield’s testing guidance clarification statement on August 27,” the agency said in a statement on Friday. “Current science shows that testing people who have been in close contact with someone with Covid-19 is an important part of preventing disease transmission.”

Previous directors of the agency said that it was normal for important documents to be cleared by administration officials at the White House and the Department of Health and Human Services, but that the degree of interference in the C.D.C.’s scientific work during the pandemic was unprecedented. The agency’s scientific recommendations and reports are normally vetted by dozens of scientists but the drafting and revising of these testing guidelines has largely been controlled by the Department of Health and Human Services and the White House task force on the coronavirus.

Dr. Thomas Frieden, who served as the agency’s director under President Obama, said the new testing recommendation was “an encouraging step in the right direction and confirms the importance of testing close contacts of people with Covid.”

“Now,” he added, “the administration needs to show that political interference with C.D.C. science will never happen again.”

In the case of this controversial guidance in August, the agency’s scientists saw early versions and made their disagreements known, but said their concerns went unheeded.

Adm. Brett P. Giroir, the administration’s testing coordinator and an assistant secretary at the Department of Health and Human Services, the agency’s parent organization, said in an interview on Thursday that the document had come from the C.D.C., but that he had edited and revised it, with input from scientific and medical members of the White House Coronavirus Task Force, and Dr. Scott Atlas, the president’s scientific adviser.

Admiral Giroir did not respond to a request for comment Friday on the new guidance.

Public health organizations said they were relieved to see science prevail again. “It is critical that science, evidence and data continue to serve as the foundation of every C.D.C. recommendation,” Dr. Mary Pittman, president and chief executive of the nonprofit Public Health Institute, said in a statement.

Dr. Susan Bailey, who heads the American Medical Association, a close partner of the C.D.C., said: “This decision acknowledges that our nation’s best interest is served when health care institutions are free to keep science at the fore of their decision-making and guidance.”

The new guidance also corrects some elementary errors C.D.C. scientists said they would never have made. It accurately refers to infection with the virus, for example, as opposed to the Covid-19 disease as the previous version did. And it does not refer to at-risk individuals as “vulnerable,” a term C.D.C. scientists generally avoid.

Still, the rapidly changing guidance has created “mass confusion,” Dr. Wen warned. Testing sites may still be turning away people, and insurance companies may be denying coverage to those without symptoms, she said.

She and others also lamented the blows to the agency’s credibility.

“One of the most important tools the C.D.C. has and the government has in times of crises is trust,” said Dr. Richard Besser, who served as acting director of the agency in 2009. “When you lose trust, it’s really hard to regain it.”

Others were less restrained in their outrage at the administration’s meddling in science.

“To see the way these people have politicized the science,” said Dr. Jha, “I have not felt rage that often.”

Dr. Jha said he was also baffled by the administration’s choice to doctor this particular testing recommendation.

“How much political benefit did they get for undermining the C.D.C. on this? Not that much, because nobody believed it,” he said. “It’s really like killing the golden goose for the egg. You only do it once.”