Malignant transformation of melanocytes is associated with changes in melanogenesis. Therefore, fluorescence of melanin may be an informative indicator of this process. But the conventionally excited autofluorescence of melanin in skin tissue is ultra-weak and its main part in the visible spectral region is hidden by the much stronger fluorescence from other endogenous fluorophores. Here, using a new mode of stepwise two-photon excitation, melanin-dominated fluorescence spectra of pigmented skin lesions are reported. From these, pure melanin fluorescence spectra of normal pigmented skin, melanocytic nevi and malignant pigmented melanoma were analyzed. They show distinctly different spectral shapes: melanoma gave a characteristic fingerprint with a fluorescence band peaking at 640 nm, independent of the melanoma subtype. The melanin fluorescence spectra peaked at 590 nm for all types of common melanocytic nevi. These differences in the fluorescence spectra are probably based on different contents of eumelanin and pheomelanin. In a series of 167 cases with melanocytic nevi and melanomas, the sensitivity of this new method to diagnose melanoma was 93.5%, the specificity 80.0% and the diagnostic accuracy 82.6%. The two-photon excitation fluorescence method is a new diagnostic tool which may in future supplement conventional dermatohistopathology.