Iron is the primary component of Earth's core. Both the solid inner core and liquid outer core are thought to consist mainly of iron, mixed with nickel and smaller amounts of lighter elements such as sulfur, oxygen, silicon, carbon, and hydrogen.
Scientists cannot directly sample the core, so its composition is inferred from earthquake waves, Earth's mass and density, magnetic-field behavior, high-pressure laboratory experiments, and comparisons with meteorites. Seismic evidence shows that the inner core is solid while the outer core is liquid. Motion in the electrically conducting outer core helps generate Earth's magnetic field.
Nickel is an important secondary component, which can make the question seem tempting, but it is not considered the main element. Oxygen and silicon are abundant in Earth's crust and mantle, yet they are not the primary constituent of the core. The core begins roughly 2,900 kilometers beneath the surface and extends to Earth's center, about 6,371 kilometers below the surface.