Lasers can help surgeons rapidly analyse brain cancers and decide how much tissue to remove, a study shows.
It is a difficult decision as taking too little leads to the cancer coming back, while too much could lead to disability.
The technique, called SRS microscopy, has been tried on more than 360 patients at the University of Michigan Medical School and Harvard University.
The next stage is for it to be tested in full clinical trials.
"Brain cancer is like a cloud, you can define the centre, but the edges are really hard to discern," says one of the researchers, Dr Daniel Orringer.
In other cancers - such as in the bowel - doctors would just take some of the non-essential surrounding tissue as well.
However, there is no non-essential tissue in the brain.
Karen Wischmeyer, a pre-school teacher in Michigan, is the type of patient who could have have benefited from the technology.
She needed two operations in quick succession to remove her brain tumour.
Two years ago, she had a massive seizure in the middle of the night and doctors found a growth in her brain.
But while surgeons removed some of the cancer, they did not get it all.
Karen told BBC News: "It would have spared a lot of anxiety and anguish and pain.
"I had two craniotomies [removing part of the skull], weeks of bad headaches, about four months total recovery time and I missed a lot of school."
She still has regular scans to ensure there is no growing tumour left in her brain.
How the technology works
At the moment, sections of brain tissue are taken to a lab to be frozen, stained with dyes and then analysed. The process can take 30-40 minutes.
The technology, described in Nature Biomedical Engineering, sits in the operating theatre.
It fires a beam of light at the tissue, and the laser-light's properties are changed depending on what it hits.
The differing chemistry of a cancerous cell and normal brain tissue means the laser help surgeons find the outside edge of a tumour.
No decisions were made with just the laser-technology while it was still being tested.
Dr Orringer said the aim was to give "more efficient, safer and more accurate care".
He told the BBC News website: "It was magical when we made that transition to the operating room.
"It makes a huge difference, the process currently in place dates back to the 1800s, and we have something disruptive, in a good way, and the implications are pretty profound."
He says one of the early lessons is "a lot of the times we think we're done operating we should probably keep going, with the microscope we have the capacity to see that".
However, it is not yet clear whether the technology will increase survival rates. That will not be known until it has been used in long-term clinical trials.
Follow James on Twitter.