The result was a draw: humans, 93.9 percent correct; A.I., 94.6 percent.

The study was paid for by the National Cancer Institute, the University of Michigan and private foundations. Dr. Orringer owns stock in the company that made the imaging system, as do several co-authors, who are company employees. He conducted the research at the University of Michigan, before moving to New York.

“Having an accurate intra-operative diagnosis is going to be very useful,” said Dr. Joshua Bederson, the chairman of neurosurgery for the Mount Sinai Health System, who was not involved in the study. He added, “I think they understated the significance of this.”

He said the traditional method of examining tissue during brain surgery, called a frozen section, often took much longer than 30 minutes, and was often far less accurate than it was in the study. At some centers, he said, brain surgeons do not even order frozen sections because they do not trust them and prefer to wait for tissue processing after the surgery, which may take weeks to complete.

“The neuropathologists I work with are outstanding,” Dr. Bederson said. “They hate frozen sections. They don’t want us to make life-altering decisions based on something that’s not so reliable.”

Dr. Bederson said that the study authors had set a very high bar for their new technique by pitting it against experts at three medical centers renowned for excellence in neurosurgery and neuropathology: Columbia University in New York, the University of Miami and the University of Michigan, Ann Arbor.

“I think that what happened with this study is that because they wanted to do a good comparison, they had the best of the best of the traditional method, which I think far exceeds what’s available in most cases,” Dr. Bederson said.

The key to the study was the use of lasers to scan tissue samples with certain wavelengths of light, a technique called stimulated Raman histology. Different types of tissue scatter the light in distinctive ways. The light hits a detector, which emits a signal that a computer can process to reconstruct the image and identify the tissue.