Previous studies have suggested eczema is linked with a reduced risk of skin cancer but it has been difficult to prove because symptoms vary and drugs used to treat the condition might also influence cancer.
The new study, published in eLife, is the first to show that allergy caused by eczema could actually protect against skin cancer, King's College said.
Professor Fiona Watt, director of the centre for stem cells and regenerative medicine at King's College London, said: "We are excited by our findings as they establish a clear link between cancer susceptibility and an allergic skin condition in our experimental model.
"They also support the view that modifying the body's immune system is an important strategy in treating cancer.
"I hope our study provides some small consolation to eczema sufferers - that this uncomfortable skin condition may actually be beneficial in some circumstances."
Dr Mike Turner, head of infection and immunobiology at the Wellcome Trust, said: "Skin cancer is on the rise in many countries, and any insight into the body's ability to prevent tumour formation is valuable in the fight against this form of cancer.
"These findings that eczema can protect individuals from skin cancer support theories linking allergies to cancer prevention and open up new avenues for exploration whilst providing some small comfort for those suffering from eczema."
Skin cancer accounts for one in every three cancers diagnosed worldwide, according to the World Health Organisation.
Malignant melanoma, the most dangerous form of skin cancer, is now five times more common in the UK than it was in the 1970s, according to research.
The new study was funded by the Medical Research Council, the Wellcome Trust and Cancer Research UK.
- PAA