The University of California Merced put out several short statements on Twitter saying the campus had been locked down after the morning incident and classes were canceled. It urged students to stay where they were.
Two of the stabbing victims were flown out by medical helicopter and three were treated on campus, the school said. All were conscious, it added.
The school initially said the suspect had been apprehended, but campus police later said officers had shot and killed the suspect. The school also initially said all five victims were students, but later rescinded that statement.
John Price, chief executive officer of Artisan Construction which was remodeling part of the school building where the attack occurred, told the Merced Sun-Star newspaper that his son was working on the project when he was stabbed.
"They heard a scuffle in the classroom right across from where they were working and it sounded like a fight. So (my son) opened the door and the guy lunged at him," Price told the newspaper.
The stabbing attack comes about a month after a gunman killed nine people at a community college in Oregon, ranking it among the deadliest of dozens of U.S. mass shootings over the past two years.
The city of Merced, where the newest addition to the University of California system is located, is some 135 miles southeast of San Francisco. The school has about 6,700 students, according to its website.