A semiconductor device includes a semiconductor substrate, a gate structure, a first spacer, a second spacer, and a first contact plug. The gate structure is disposed on the semiconductor substrate. The first spacer is disposed around the gate structure. The second spacer is disposed on the first spacer. The first contact plug lands on the second spacer and the gate structure.