From the Super Mario Wiki
Spikes are pointy objects that usually lead to losing lives. These traps appeared in nearly all Mario games, from spin-offs to regular ones. They were first introduced in Super Mario Bros. 2 though Icicles in Mario Bros. are functionally the same until they fell. In Super Mario World 2: Yoshi's Island, Yoshi's Island: Super Mario Advance 3 and Yoshi's Island DS, spikes are found mostly in castles. A more common rough object, a thorn, also appears in the two Yoshi's Island games. In Yoshi's Story, spikes actually move and jump around in the Bone Dragon Pit and Magma Castle.
Spikes also appear in Yoshi Topsy-Turvy, along with the Mario vs. Donkey Kong series. In these games, the spikes instantly take out any Mini Mario that touches it. It also causes an instant loss if Mario touches them in Mario vs. Donkey Kong.
Spikes operate differently between their game appearances. In most Mario series titles, they can't completely take out Mario, unless he's small. However, in a few cases, spikes attached to moving walls can squish Mario and make him lose a life regardless if he's small or has a power-up. In Super Mario World 2: Yoshi's Island and Yoshi's Island DS, spikes will always cause a Yoshi to lose a life. In Yoshi's Story, spikes only damaged the Yoshis, but can't take them out unless their happy meter has no petals.
In Super Mario Sunshine, spikes make an appearance only in Corona Mountain, where they act as obstacles alternating with fire traps. These spikes are retractable, and will continually go in and out every few seconds. If Mario touches the spikes when they are out, he will usually lose a life.
In Super Mario Galaxy 2, spikes reappear as obstacles in galaxies including the Flip-Out Galaxy and the Clockwork Ruins Galaxy, among others (though they appear more prominently in the Flip-Out Galaxy). They are retractable in this game as well, and while they will not cause immediate loss of life for the player should they touch them, they will cause Mario to run around uncontrollably for a few seconds, during which the player may be subject to falling off cliffs, or fall victim to other lesser hazards.
Non-retractable spikes also make an appearance in Super Mario Galaxy 2, where they are encountered partway through the first mission of the Flipsville Galaxy. Because they are non-retractable, they obviously remain entirely stationary, and so the only danger they actually pose is if the player accidentally touches them while traversing this part of the level, or if they attempt to Ground Pound a flipping cage in the ground while a moving platform is positioned over the spikes. These spikes are also noticeably different from the previous type in that they are pyramid-shaped, as opposed to being cone-shaped. They also appear positioned on multiple sides of a surface, as opposed to just facing upwards from the ground.
 Names in Other Languages