Mohs surgery is the most effective treatment for basal and squamous cell carcinomas, but the procedure can also effectively treat melanoma.