The Los Angeles County Sheriff said the suspect had been detained near Highland High School in Palmdale, 40 miles (65 kilometers) north of downtown Los Angeles.
Both were students at the school.
"Deputies responded immediately to Palmdale shooting, arrest made, weapon found, active investigation underway. Reasonably sure threat is contained," department spokesman Jim McDonnell tweeted.
The suspect was a "male Hispanic juvenile," the sheriff's office said, later clarifying that the weapon was a rifle that was "recovered off campus."
The sheriff's office said a boy had been shot in the arm at the school and was in stable condition at a local hospital.
Local media reported that the victim, also 14, was wounded as he was getting out of the car that brought him to the campus.
Agents with the Department of Alcohol, Tobacco, Firearms and Explosives (ATF) were heading to the scene, the agency said.
Deputies said they had secured both locations, and were investigating.
"We are all concerned about the safety of our children," Palmdale School District Superintendent Raul Maldonado said in an alert.
"It has been confirmed that earlier this morning, there was an active shooter on the Highland High School campus. Apparently, the person was already apprehended.
"I want to let you know that all of the Palmdale Elementary Schools were put on lockdown, and will stay on lockdown until the situation is confirmed as safe for our students, teachers, staff and parents."
Highland confirmed in a tweet that it saw "no threat" to pupils and added that staff were working with law enforcement to determine release procedures for students.
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)