From the Super Mario Wiki
The Hourglass Block is an object in the NES release of Mario's Time Machine. It is a kind of block that, when hit from below, spins around. This makes them briefly intangible and allows Mario to jump through them. After a short period of time, they return to their normal position. Some Hourglass Blocks can be destroyed if Mario Spin Jumps on top of them, while others are not affected by his jump. They also appear in different colors. They are comparable to Rotating Blocks.