From the Super Mario Wiki
The Spinning Heart is a red translucent heart that slowly revolves on the ground. When Mario runs through it, the Spinning Heart will quickly replenish his Health Meter in proportion to the speed with which he runs through it. Thus, the faster he runs through it, the more health he recovers. In the remake of the game, Super Mario 64 DS, Yoshi, Luigi and Wario can also use this object to recover their own Health Meters.