Artificial intelligence can identify skin cancer in photographs with the same accuracy as trained doctors, say scientists.
The Stanford University team said the findings were "incredibly exciting" and would now be tested in clinics.
Eventually, they believe using AI could revolutionise healthcare by turning anyone's smartphone into a cancer scanner.
Cancer Research UK said it could become a useful tool for doctors.
The AI was repurposed from software developed by Google that had learned to spot the difference between images of cats and dogs.
It was shown 129,450 photographs and told what type of skin condition it was looking at in each one.
It then learned to spot the hallmarks of the most common type of skin cancer: carcinoma, and the most deadly: melanoma.
Only one in 20 skin cancers are melanoma, yet the tumour accounts for three-quarters of skin cancer deaths.
The experiment, detailed in the journal Nature, then tested the AI against 21 trained skin cancer doctors.
One of the researchers, Dr Andre Esteva, told the BBC News website: "We find, in general, that we are on par with board-certified dermatologists."
However, the computer software cannot make a full diagnosis, as this is normally confirmed with a tissue biopsy.
Dr Esteva said the system now needed to be tested alongside doctors in the clinic.
"The application of AI to healthcare is, we believe, an incredibly exciting area of research that can be leveraged to achieve a great deal of societal good," he said.
"One particular route that we find exciting is the use of this algorithm on a mobile device, but to achieve this we would have to build an app and test its accuracy directly from a mobile device."
Incredible advances in machine-learning have already led to AI beating one of humanity's best Go players.
And a team of doctors in London have trained AI to predict when the heart will fail.
Dr Jana Witt, from the charity Cancer Research UK, said: "Using artificial intelligence to help diagnose skin cancer is very interesting, as it could support assessments by GPs and dermatologists.
"It's unlikely that AI will replace all of the other information your clinician would consider when making a diagnosis, but AI could help guide GP referrals to specialists in the future."
Brett Kuprel, another researcher on the project, added: "The end-to-end training and transfer learning approaches we used can be applied to many problems in healthcare, provided there is a large enough dataset.
"It could transform treatment in ophthalmology, dermatology, and radiology."
Follow James on Twitter.