The answer to this question is complex because the Alhambra is a whole series of buildings and places which were built at different times.
The first work started in the year 888.
For a better and more detailed answer click here