It depends on context, as always.
In the following sentences, the first is a noun. The second is a combination of words making up an adjective.
My son is a 10-year-old.
My son is 10 years old.
Here, the first is an adjective.
I have a bottle of 10-year-old whisky at home