The suspect, a male student, was arrested in the same chemistry building shortly after the stabbing.
UCLA spokesman Phil Hampton said the victim and suspect were both 20-year-old seniors taking an organic chemistry class along with other students who were in the undergraduate teaching lab at the time.
The woman underwent surgery for multiple stab wounds at Ronald Reagan UCLA Medical Center, and was in stable condition Thursday night, Los Angeles police said.
Cyril Baida, a teaching assistant who was working in a lab across the hall, said he saw the victim stagger out of the lab while another teaching assistant applied pressure to her neck, Baida said.
"The poor girl was completely drenched with blood. She was talking at first but then she started fading away," he said. "We told her she was going to be fine and to keep breathing so she didn't pass out. I told the other TA that he was doing great so he didn't faint either."
Baida said he did not know the victim or the suspect, but was told that they were lab partners or had worked together in a small group on projects in their lab section.
Los Angeles city police and campus police interviewed about 30 witnesses who were in or near the lab and might have seen the attack, Campus Police Assistant Chief Jeff Young said. No names have been released, and the motive is under investigation.
"Her TA _ that guy deserves a medal. He had his hands around her wounds and was yelling, 'Call 911,'" said Baida, a 26-year-old biochemistry graduate student. "I called 911 and told him to bring her into our lab. He kept holding her so she wouldn't bleed until the paramedics arrived."
Baida said the organic chemistry lab where the attack took place is a demanding class.
"All my students have taken it and they hate it. Usually people bond during classes like that because they have to study together. I don't think it was so tough that it makes people go crazy," he said. "It's awful, but things like this can happen anywhere."
UCLA Chancellor Gene D. Block said the campus community was shocked by the attack and "wishing for the speedy recovery of the young woman who was injured."