Derived in masculine from the feminine nieta, from Vulgar Latin nepta, from Latin neptis "granddaughter", from nepos "grandson, granddaughter, nephew" (cf. French neveu "nephew", Italian nipote "grandchild, nephew, niece", Portuguese neto "grandson", Romanian nepot "grandson, nephew"). See also niece and nephew.
The noun nieto is like several other Spanish nouns with a human referent. The masculine forms are used when the referent is known to be male, a group of males, a group of mixed or unknown gender, or an individual of unknown or unspecified gender. The feminine forms are used if the referent is known to be female or a group of females.