From the Super Mario Wiki
The Golden Hammer is an item that appears in Wrecking Crew. It is a stronger version of the hammer the player normally carries that the player can swing faster, can break walls in a single hit, and can also attack enemies to send them to the bottom of the screen. The player can also temporarily hover in midair by pressing and fast enough. To obtain a Golden Hammer, the player must swing their hammer a number of times so that the number of swings plus the stage number divided by eight leaves a remainder of one; the earliest a Golden Hammer can appear is the fourth stage. In addition, the player must also strike a certain bomb to obtain the hammer.
The Golden Hammer also appears as an item in the Super Smash Bros. series starting with Super Smash Bros. Brawl. It acts similar to the Hammer from previous Super Smash Bros. games, based on the Hammer in Donkey Kong. It stands on a pedestal, and when picked up, the player starts swinging the hammer up and down. It is swung faster than a normal Hammer, each hit does 30% damage, and it launches characters at a more horizontal angle than a regular Hammer. In addition, repeatedly tapping the attack button will allow the player to float in mid-air while holding this item, like with the Golden Hammer in Wrecking Crew and unlike the normal Hammer. Although the head does not fly off like the regular Hammer, it can instead become a Squeaky Hammer. The 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 / Wii U.
Super Smash Bros. Brawl
Super Smash Bros. for Nintendo 3DS / Wii U