During recent years, urban ecological deterioration and environmental pollution are getting worse. Assessment of urban ecological security has become an important area in geoscience, resource and environmental science, ecology and ecological economics. This paper constructed an assessment index system of urban ecological security. The index system was composed of ecosystem pressure, ecosystem state and human response. Then the paper introduced set pair analysis (SPA) theory into urban ecological security assessment and established an assessment model. Finally the paper used the model to assess ecological security conditions in Shenzhen from 1997 to 2008. The results show that security conditions in Shenzhen belong to "critically secure" grade from 1997 to 2001, and belong to "relatively secure" grade from 2002 to 2008. There is a tendency of gradual improvement in ecological security conditions of Shenzhen. SPA method embodies certainties and uncertainties in the assessment system and has broad application prospects.