WASHINGTON—A U.S. judge blocked the federal government from funding research involving human embryonic stem cells, a surprise blow to one of the most promising yet controversial areas of current scientific research.

The ruling, which could affect hundreds of millions of dollars in federal funding, was cheered by some Christian groups as a defense of human life and denounced by scientists who called it a major setback for medical research.

It...