From the Super Mario Wiki
Li'l Sparkies, also called Sparkies, are small sparks that travel along platforms, first appearing in Super Mario World. In later games, they seem to be almost completely replaced by Amps, an unlikely relative with similar traits and behavior. They are also similar to Sparks.
Super Mario series
Super Mario World
The Li'l Sparky (or Lil Sparky) makes its debut in Super Mario World. They are immune to everything but Invincible Mario. Additionally, larger ones (referred to as Hotheads) can be found in #6 Wendy's Castle and Bowser's Castle.
Super Mario Advance 4: Super Mario Bros. 3
In Super Mario Advance 4: Super Mario Bros. 3, Li'l Sparkies are found in the World-e levels Swinging Bars of Doom, A Sky-High Adventure and Puzzling Pipe Maze. Unlike in Super Mario World, they can be defeated by Statue Mario's stomp or by Hammers thrown by Hammer Mario.
In Paper Mario, a Li'l Sparky named Watt was imprisoned and tortured by the Big Lantern Ghost. After Mario defeats the Lantern Ghost, Watt joins Mario's party, making her the first playable Li'l Sparky.
Mario & Luigi: Superstar Saga / Mario & Luigi: Superstar Saga + Bowser's Minions
In Mario & Luigi: Superstar Saga and Mario & Luigi: Superstar Saga + Bowser's Minions, Li'l Sparkies make a small cameo in a pseudo-sidescrolling level to reach a Monty Mole. If Mario or Luigi is attacked by them, he will get knocked back to the beginning.
Super Princess Peach
Names in other languages