From the Super Mario Wiki
Invincible Mario is a form Mario and Luigi assumes after using a Star. In this state, which only lasts for a few seconds, he is resistant to any enemy. Additionally, he is able to defeat most of them by simply touching them. However, he may die from falling into a pit, in lava, or in poison water, being crushed, Volcano Smog, or when the time runs out. Invincible Mario, just like the Star, made his first appearance in Super Mario Bros.. Invincibility is depicted by a flashing, and, in later games, also color-changing character. Beginning in Super Mario Bros. 3, Mario now flips when he jumps in this form, in a similar fashion to Samus Aran, who only appears alongside Mario in the Super Smash Bros. series. Since this is not really a transformation, Mario can become invincible and maintain the form he had before, for example, if he is Fire Mario and gets a Star, he becomes invincible, but he is still in Fire form. Wario can also become invincible, and also much faster, in Wario Land: Super Mario Land 3 by using a Starman as well. In most games, when Mario, upon being touched by an enemy for example, changes his form to a less powerful one (usually Small Mario), he will be invulnerable for a few seconds as well.
In the Mario Kart series, every driver could become invincible by collecting and using a Star, allowing them to make other drivers slide or tumble by touching them and make them drive faster. In Super Mario Galaxy and Super Mario Galaxy 2, there is a similar form known as Rainbow Mario that can be obtained by using a the Rainbow Star.
In Super Mario Bros. 3, Super Mario World, New Super Mario Bros., New Super Mario Bros. Wii, and New Super Mario Bros. 2, there are some ? Blocks that normally contain coins but will contain Starmen if Mario or Luigi is invincible when they strike the block. This allows the player to string together a long period of invincibility.
Starting in Super Mario World, Invincible Mario could get extra lives by defeating eight (five in Super Mario Land 2: 6 Golden Coins and Super Mario 3D Land) or more enemies while invincible, and will keep getting lives for each additional enemy defeated until the Star wears off completely, and the player becomes vulnerable again. In Wario Land: Super Mario Land 3, Wario gains 11 hearts for each enemy destroyed through physical contact in this state.
In The Super Mario Bros. Super Show!, neither Invincible Mario or Luigi ever made an appearance, as a Starman would not turn Mario or Luigi invincible, but instead served as an alternative to the Fire Flower for becoming "Super Mario" or "Super Luigi". In The Adventures of Super Mario Bros. 3 and Super Mario World, Starmen functioned as they normally did in the games, granting them their invincible forms for a limited time.
Additionally, in the Donkey Kong series, the Kongs can get invincible by breaking through an Invincibility Barrel. While in the invincible form, they take the same effects as if they touched a Super Star, such as flashing and defeating enemies without performing a specific move. They also lose a life when they fall in a pit, even when invincible.
In New Super Mario Bros. 2, Mario and Luigi can defeat any enemy when invincible. The new Boohemoth, a new species of Boo introduced the game, is so huge that even when invincible, Mario and Luigi cannot defeat it and if they are standing near an obstacle and the Boohemoth catches up to them, Mario/Luigi will lose a life.
Names in other languages