The segmentation is the most important step to automatic diagnosis of the skin lesions. In this paper, a DWT2 thresholding based segmentation of dermatoscopic images has been proposed to diagnose of the pigmented skin lesions. In the proposed method, first, the image is converted to YUV channels and after denoising and contrast enhancement of the second channel of the converted image, it is decomposed to wavelet transform in two levels. Then, to more specificity and accuracy of segmentation, the Otsu's thresholding method is applied on each sub-band of the second level of decomposed image and four thresholds are achieved. Subsequently, using adding all thresholds a new threshold is obtained and applied on the second level reconstructed image to achieve a binary image. Finally, post-processing is applied on this binary image using algorithms of morphological reconstructions, to increase the sensitivity. The experimental results show that the proposed method increases the accuracy to 90.97%, and specificity to 99.76%, compared with the other existing methods.