The weapon used, an SKS rifle, was found discarded in a field, McDonnell said.
The identities of the shooter and the victim, both aged 14, have not been disclosed to the public.
Los Angeles County sheriff's spokeswoman Nicole Nishida says the 15-year-old victim was shot in the arm Friday morning and is expected to fully recover.
Investigators were trying to determine what led up to the shooting and whether the boys knew each other.
She said the suspect was found in the shopping center.
The FBI and agents from the Bureau of Alcohol, Tobacco, Firearms and Explosives also responded to the scene. The victim was shot in the arm and was transported by a nearby civilian to the hospital, where he is in stable condition, McDonnell said.
In March, a teacher accidentally discharged a gun during a public safety class at Seaside High School in Seaside, California, injuring a student.
It is unknown why or when the student was pulled from the school or if he had previous issues with officials.More news: Hulu Eyeing Brooklyn Nine-Nine After Cancellation
More news: Facebook bans ads on Ireland's abortion referendum by foreign advertisers
More news: Kendall Jenner's Secret Fight with Sister Kylie Lead's Today's Star Sightings
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.
Highland High student Katharina Smith, 16, said she was driving to the school when she saw "a ton of police racing toward school".
Highland High School is located about 65 miles from Los Angeles.
Local media reported that the victim, also 14, was wounded as he was getting out of the vehicle that brought him to the campus.
Santa Clarita Valley Sheriff's deputies were searching the grounds of Highland High School in Palmdale, the agency reported on its Twitter account.
The suspect, a former student at Highland High School, was taken into custody at a supermarket by an off-duty Los Angeles police officer after the boy called his father to tell him that he had fired a gun into the air, McDonnell said.
About a half-hour afterward, calls were received of "shots fired" heard near the campus of Manzanita a Elementary School on the 38600 block of 33rd Street East, the sheriff's department reported.