Scientists have found a secret planet hiding in one of the most famous star systems in our galaxy — and they discovered it almost by accident.

Astronomers using NASA's James Webb Space Telescope spotted the hidden world, called Beta Pictoris d, orbiting a young star 63 light-years away from Earth. The star, Beta Pictoris, was already known to have two giant planets. This new discovery makes it only the second planetary system ever found with three directly imaged planets orbiting it.

The team wasn't even looking for a new planet when they made the discovery. They were studying the atmosphere of Beta Pictoris b, one of the first exoplanets ever directly photographed by scientists. But while analyzing data from Webb's NIRSpec instrument, which splits light into a rainbow-like spectrum to reveal what chemicals are present, they noticed something unexpected: a distinctive pattern of carbon monoxide absorption lines, spread out like a barcode.

"We weren't looking for a new planet," said Aidan Gibbs, lead author of the study published in the Astrophysical Journal Letters and a postdoctoral researcher at the University of California, San Diego. "We were trying to understand one we already knew existed. Then, this telltale signal appeared in the data where we didn't expect it."

Unlike traditional planet hunting, which relies on spotting bright points of light, this new technique identifies a planet by detecting its chemical fingerprint in the atmosphere. Because spectroscopy reveals not just chemistry but also motion, the team could tell the object was actually orbiting Beta Pictoris — not just drifting in the background. Follow-up observations detected water vapor and methane, further confirming it was a planet and not a mistake.

Beta Pictoris d is likely at least twice the mass of Jupiter, making it the smallest of the three giant planets in the system. It orbits at about 30 astronomical units from its star — roughly the same distance Neptune sits from our Sun. At about 23 million years old, the entire system is relatively young compared to our own solar system's 4.5 billion years.

Jean-Baptiste Ruffio, a research scientist at UC San Diego and principal investigator of the observations, said the spectroscopic approach changes everything about how scientists can study distant worlds. "A spectrum contains an incredible amount of information," he said. "You don't just learn that something is a planet; you immediately begin learning about its temperature, chemistry and motion."

For the scientists, Beta Pictoris has long been a cosmic laboratory for understanding how planets form and grow. Now, with a third world added to the family, that research can continue — and the new technique could help astronomers find hidden planets around other stars too.