Laser-guided surgery could improve the odds of removing all of a brain tumour by clearly highlighting its edges, US researchers say.
Surgeons are cautious with brain tumours as removing the surrounding tissue could lead to disability.
A technique, reported in Science Translational Medicine, used a laser to analyse the chemistry of the tissue and show the tumour in a different colour.
Brain tumour researchers said it could be an "exciting development".
Removing a brain tumour is a balancing act - take too little and the cancer could return, take too much and it seriously affects a patient's quality of life.
The key is knowing the boundary of the tumour. Surgeons take sections of the tumour and surrounding tissue and look under a microscope for the differences between the two to find cancer's edge.
A team at the University of Michigan Medical School and Harvard University have come up with a new way of analysing the tissue, called SRS microscopy, while it is still in the brain.
A laser is fired at the tissue. However, the beam of light's properties are changed depending on what it hits. The differing chemistry of a cancerous cell and normal brain tissue mean the laser can show a surgeon the outside edge of a tumour.
Dr Daniel Orringer told the BBC: "Neurosurgery is plagued by a problem, it's very difficult to see when a brain tumour ends and normal tissue begins.
"If you're removing a colon cancer you can take 2cm either side with no damage, but in the brain it could disable a patient.
"SRS microscopy allows us to see the margins on an microscopic scale."
The method has been tested in mice and on human brain samples, but actual trials in patients are still needed.
This is just the latest in a series of developments aimed at improving surgery. A team at Imperial College London have developed a knife that can detect the "smell" of cancer so it knows if it is cutting through tumour or healthy tissue.
Dr Colin Watts, a Cancer Research UK brain tumour expert at the University of Cambridge, said: "It needs to be tested in a clinical trial, but this technique could be an exciting development in visualising tumour tissue, which is the first step in enhancing removal of disease.
"A crucial factor will be to ensure that patient safety is not compromised. This technique is particularly exciting because it has the potential for helping us to remove tissue at the tumour/brain interface from where recurrent disease can emerge.
"It will also be interesting to determine if SRS microscopy can be used in tumours that recur after treatment."