From the Super Mario Wiki
The Golden Hammer is an item that first appeared in Famicom game Wrecking Crew and reappears as an item in the Super Smash Bros. series starting with Super Smash Bros. Brawl. It is based on the Hammers found in the Mario series, which had the same uses and effects. It is similar to the Hammer from previous Super Smash Bros. games, except that the Golden Hammer is far more efficient. It stands on a pedestal, and when picked up, the player starts swinging the hammer up and down, devastating anyone who gets hit. It is swung faster than a normal Hammer. Repeatedly tapping the item button will allow the player to float in mid-air while holding this item, unlike the hammer. Each hit does 30% damage. It launches characters at a more horizontal line than a regular Hammer. Although the head does not fly off like the regular Hammer, it does have one other problem that will randomly occur; it will become the Squeaky Hammer. The golden Squeaky Hammer will only squeak if it hits someone instead of doing damage. However, it can still allow the player to float in midair.
The Golden Hammer can also be used to open the windows in Challenges. They can be earned by completing challenges that have windows containing Golden Hammers. There are only five Golden Hammers in Super Smash Bros. Brawl and Super Smash Bros. for Wii U, and three per panel in Super Smash Bros. for Nintendo 3DS. Golden Hammers cannot break windows that pertain to challenges related to Boss Battle Mode in Super Smash Bros. Brawl (PAL versions of the game, however, do not have this limitation) and certain other challenges in Super Smash Bros. for Nintendo 3DS.
Super Smash Bros. Brawl
Super Smash Bros. for Nintendo 3DS