From Sonic Retro

Invincibility is a power-up found in most Sonic games, obtained by breaking a monitor. It temporarily protects the player from harm, as well as allowing him to destroy most enemies by touching them. While the player is immune to most traps and attacks, it is still possible to be killed by being crushed, drowning, falling off the level, or (in Sonic & Knuckles) losing all your rings to Toxomister's smoke (which you are not invincible from).

While invincible, the player is surrounded by a sparkling effect which varies in appearance from game to game. In the 2D Genesis-era games, characters were surrounded by flickering stars, while in 3D Invincibility tends to take the form of a rainbow aura.