For this glitch, the player must have a power-up that will turn them into Super Mario when hit. That could be either a fire flower (all), tanooki leaf (SMB3), cape feather (SMB4/SMW) & propeller mushroom (NSMBU). We recommend the fire flower, as that works on all theme, but you can really pick the other ones (except if you are using the SMB1 theme. Then, you'd have to use a fire flower as the weird Mario powerup takes you directly to small Mario.) If the player takes any form of damage and enters a door when the invincibility frames are about to end, Mario will retain the invincibility for the duration of the course; he cannot take damage from enemies or obstacles, except for bottomless pits or lava which automatically cause the player to lose a life. While in this state the player also cannot collect any power-ups except for Super Stars.
This likely happens due to how post-damage invincibility functions in the game. By entering the door at the end of the invincibility frames, the player circumvents the invincibility timer. Therefore, even though he is not blinking, when he exits the door, he is still invincible.
The best way to use this glitch is to place spikes on the bottom.