The moon may have formed after a giant Mars-size rock hit a magma-covered newborn Earth, a new study finds.

Earth came together about 4.5 billion years ago, and previous research suggested the moon arose a short time later. For the past three decades, the prevailing explanation for the moon's origin was that the moon resulted from the collision of two protoplanets, or embryonic worlds. One of those was the newborn Earth, and the other was a Mars-size rock called Theia, named after the mother of the moon in Greek myth. The moon then coalesced from the debris.

This "Giant Impact Hypothesis" seemed to explain many details about Earth and the moon, such as the large size of the moon compared with Earth and the rotation rates of the two bodies. However, in the past 15 or so years, evidence has emerged to challenge it and suggest a multitude of alternatives.

Related: How the Moon Formed: 5 Wild Lunar Theories

Computer models of the giant-impact scenario often say that more than 60 percent of the moon should be made of material from Theia. The problem is that most bodies in the solar system have unique chemical makeups, and Earth, Theia and therefore the moon should also. However, rock samples from the moon show its composition is uncannily more similar to Earth than such models would predict when it comes to versions of elements called isotopes. (Isotopes of an element each have different numbers of neutrons.)

To help solve this mystery, one recent lunar formation model suggested the moon might have formed from an impact so violent, it vaporized a large portion of the early Earth, with the moon emerging from the resulting doughnut-shaped mass called a synestia. Another suggested the collision involved a fast-spinning proto-Earth. However, a shortcoming with such models is that these scenarios require unlikely impact conditions, study lead author Natsuki Hosono, a planetary scientist at the Japan Agency for Marine-Earth Science and Technology in Yokohama, told Space.com.

Related: How the Moon Was Made: Lunar Evolution Explained (Infographic)

To address this puzzle, Hosono's team now suggest that a large fraction of material from Earth could have reached orbit to help form the moon if Earth was partially molten at the time of the giant impact.

The researchers developed computer models simulating Earth covered with an ocean of magma, which most models of the planet's formation suggest the planet had soon after its birth. They next analyzed what happened when a Mars-size rock about a tenth of Earth's mass hit this molten protoplanet.

The scientists discovered that even a glancing blow from Theia could knock more than 70 percent of the moon-forming debris out of Earth's magma ocean, since molten rock was easier to blast off Earth than solid material. These findings could help explain the compositional similarities between the moon and Earth while also explaining details such as their rates of rotation, they said.

"Prior work on lunar formation basically ignored the effect of the magma ocean," Hosono told Space.com. "Our research concluded that the magma ocean is one of the most important things for the moon-forming giant impact."

The new model suggests the amount of debris from an impact off a molten Earth was comparable to the current mass of the moon. However, prior work suggested that in order to build the moon, the giant impact first needed to generate an amount of debris equal to about three to four times the moon's mass, Hosono said. Future research might consider larger masses for Theia and factor in the rotation of the proto-Earth to see if that might lead to enough debris to form a moon of the right size, Hosono added.

The scientists detailed their findings online today (April 29) in the journal Nature Geoscience.

Follow Charles Q. Choi on Twitter @cqchoi. Follow us on Twitter @Spacedotcom and on Facebook.

SIGN UP FOR THE MACH NEWSLETTER AND FOLLOW NBC NEWS MACH ON TWITTER, FACEBOOK, AND INSTAGRAM.