A semiconductor device includes a semiconductor substrate, a T-shaped gate electrode, a moisture-proof insulating film, and an interlayer dielectric film. The T-shaped gate electrode has a leg portion joined to the semiconductor substrate and an overhanging head portion spaced from the semiconductor substrate. The T-shaped gate electrode includes a gate metal containing a material reactive with water. The moisture-proof insulating film is located only in the vicinity of the leg portion and covers a side surface of the leg portion of the T-shaped gate electrode. The interlayer dielectric film is located between the overhanging head portion of the T-shaped gate electrode and the semiconductor substrate and has a dielectric constant that is lower than that of the moisture-proof insulating film.