It overturns an unprecedented move by the Obama administration's Health and Human Services Director Kathleen Sebelius to require a prescription for girls under 17 years old.
The decision comes after a decade-long fight over who should have access to the pill and under what circumstances.
Judge Edward Korman blasted Sebelius, calling her explanation - that 11-year-old girls might not be able to understand how to use the drug properly - "politically motivated, scientifically unjustified and contrary to agency precedent."
Korman accused the federal government of "bad faith" in dealing with the requests to make the pill universally available.
"More than 12 years have passed since the Citizen Petition was filed and eight years since this lawsuit commenced," Korman said. "The FDA has engaged in intolerable delays in processing the petition. Indeed, it could accurately be described as an administrative agency filibuster."
He gave the agency 30 days to decide only whether the pills' package should include additional labeling.
The Justice Department didn't immediately say whether it would appeal the ruling.
"We are reviewing the decision and evaluating the government's options," said F. Franklin Amanat, a lawyer for the government.
It's the latest twist in a decade-long push for easier access to emergency contraception, which can prevent pregnancy if taken soon enough after unprotected sex.
The Food and Drug Administration actually was preparing to lift all age limits on Plan B One-Step in late 2011 when Health and Human Services Secretary Kathleen Sebelius, in an unprecedented move, overruled her own scientists. Sebelius said some girls as young as 11 are physically capable of bearing children but shouldn't be able to buy the pregnancy-preventing pill on their own. President Barack Obama said he supported the decision, also citing concern for young girls.
"This case is not about the potential misuse of Plan B by 11-year-olds," Korman wrote, saying the number of young girls using such drugs "is likely to be minuscule."
Yet the sales restrictions are making it hard for women of all ages to buy the pills, especially young and low-income ones, he said.
Moreover, Korman noted that numerous over-the-counter drugs are dangerous for children, but are still sold nevertheless without age requirements, while "these emergency contraceptives would be among the safest drugs sold over-the-counter."
"It has been clear for a long time that the medical and scientific community think this should be fully over the counter and is safe for women of all ages to use," said Dr. Susan Wood, who resigned as FDA's women's health chief in 2005 to protest Bush administration foot-dragging over Plan B.
"Having worked on this for many years, the judge really wanted to make it clear that FDA had come to a scientific determination and was once again overruled, and that is not acceptable," she added.
The Center for Reproductive Rights, which filed suit against the age restriction, and other groups have argued that contraceptives are being held to a different and non-scientific standard than other drugs and that politics has played a role in decision-making.
"I think this is a landmark decision in terms of providing women and girls in the United States access to a safe and effective form of birth control," said attorney Andrea Costello with the Partnership for Civil Justice Fund.
Social conservatives criticized the ruling.
"This ruling places the health of young girls at risk," said Anna Higgins of the Family Research Council. "There is a real danger that Plan B may be given to young girls, under coercion or without their consent. The involvement of parents and medical professionals act as a safeguard for these young girls. However, today's ruling removes these commonsense protections."
The judge said the FDA decided after 11 months, 47,000 public comments and hundreds of thousands, if not millions, of dollars spent, that it did not need rulemaking on the subject.
"The plaintiffs should not be forced to endure, nor should the agency's misconduct be rewarded by, an exercise that permits the FDA to engage in further delay and obstruction," he wrote.
Four years ago, Korman was highly critical of the Bush administration's initial handling of the issue when he ordered the FDA to let 17-year-olds obtain the medication, instead of setting the age at 18. At the time, he accused the government of letting "political considerations, delays and implausible justifications for decision-making" cloud the approval process.
The morning-after pill contains a higher dose of the female progestin hormone that is in regular birth control pills. Taking it within 72 hours of rape, condom failure or just forgetting regular contraception can cut the chances of pregnancy by up to 89 percent. But it works best within the first 24 hours.
If a woman already is pregnant, the pill has no effect. It prevents ovulation or fertilization of an egg. According to the medical definition, pregnancy doesn't begin until a fertilized egg implants itself into the wall of the uterus. Still, some critics say Plan B is the equivalent of an abortion pill because it may also be able to prevent a fertilized egg from attaching to the uterus, a contention that scientists - and Korman, in his ruling - said has been discredited.
This story includes information from The Associated Press