BARCELONA, Spain — A nurse in Spain has become the first health worker to be infected with the Ebola virus outside of West Africa, raising serious concerns about how prepared Western nations are to safely treat people with the deadly illness.

The nurse contracted the illness while treating a Spanish missionary who was infected in Sierra Leone and flown to Madrid’s Carlos III hospital, where he died on Sept. 25, Spain’s Health Ministry said. The priest, Manuel García Viejo, died three days after being flown back to Spain, and the nurse entered his room only twice, including once after his death, according to Antonio Alemany, a health official from the regional government of Madrid.

The case is particularly worrisome to health experts because Spain is a developed country that is considered to possess the kind of rigorous infection control measures that should prevent disease transmission in the hospital. Although the Ebola epidemic has killed hundreds of doctors and nurses in West Africa, health officials in Europe and the United States have reassured the public repeatedly that if the disease reached their shores, their health care systems would be able to treat patients safely, without endangering health workers or the public.

While the risk to hospital workers is thought to be far lower in developed countries, the infection of the Spanish nurse, along with the missteps in dealing with Ebola in Dallas, exposes weak spots in highly praised defense systems.

Ana Mato, Spain’s health minister, said in a televised news conference that the nurse, who has not been identified publicly, tested positive for Ebola twice, and that the rest of the 30-person team that looked after the missionary would be monitored to see if any of its members develop symptoms of Ebola. She said it was not clear how the nurse became infected.

“It is certainly a sobering moment whenever we see a health care worker infected,” said Abbigail Tumpey, a spokeswoman for the Centers for Disease Control and Prevention in the United States. “It really highlights the need for rigorous infection control throughout everything health care workers are doing, starting with the triage of patients, getting patients into appropriate isolation and then appropriately treating and managing the patient. Any lapse could potentially expose somebody.”

Health officials in Spain said the team was properly equipped with protective gear, including gloves, gowns, masks and eye protection. The gear is meant to prevent exposure to bodily fluids, which spread the disease. But experts say the greatest risk comes from removing contaminated gear, which must be done according to a strict protocol to avoid infecting oneself. It takes training and practice.

The case in Dallas, Ms. Tumpey added, has led the C.D.C. to redouble its efforts to urge hospitals to be on the lookout for potential cases and to handle them correctly.